0
我有一個LinearLayout與3個孩子權重設置其比例:1/7,3/7,3/7。最後一節包含的文本可能會超出允許的空間,所以我添加了一個滾動視圖。ScrollView填充屏幕時,子視圖太大
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="vertical"
android:background="@drawable/package_status_border"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3">
<TextView
android:id="@+id/PackageContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</ScrollView>
</LinearLayout>
這種佈局是工作的罰款,如果PackageContent文字太小: expected formatting
但是,如果PackageContent文本是大的,而不是保持期望的高度,只是滾動它填補了多餘的文字整個屏幕: bad formatting, with scroll view filling entire screen
如何確保最後一部分仍然只有3/7的屏幕,與內容滾動,無論textView包含多少內容?
我也試過把ScrollView放在它自己的LinearLayout中,但是也沒有工作。
不,同樣的問題,使用FrameLayout – user2957533