我有这样一个布局:视图高度的最大允许值?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="21474836px"
android:text="TextView" />
</RelativeLayout>
</ScrollView>
但没有显示出来,我改2147483647px到214748364px,显示文本,但不会滚动,而当我改21474836px,一切工作正常。
任何人都可以解释这一点吗?这里的最大值是多少?
更新:我想用一个非常大的视图,实现了半无限视图,我用像素来代替DP这里,因为我不知道是否有一个限制,无论是在PX表达或dp?
我同意,dp比px好。 – Flynn81 2012-07-27 12:28:35
它不是完整的代码,我删除了无关的属性。完整的代码实际上编译。我需要使用非常大的relativeLayout作为半无限视图。 – molikto 2012-07-27 12:29:09
重新审查布局文件中的所有内容很重要 - 因为简单的事情可能会产生很大的后果;而你甚至不知道。请粘贴您的完整代码。 – 2012-07-27 12:32:27