我有這樣一個佈局:視圖高度的最大允許值?
<?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