<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:background="#000000"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/linear1"
android:background="#FF0000"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:background="#00FF00"
android:id="@+id/linear2"
android:layout_width="match_parent"
android:layout_height="200dip"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:background="#0000FF"
android:id="@+id/linear3"
android:layout_width="match_parent"
android:layout_height="100dip"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
To jest mój układ i spodziewałem się zobaczyć czerwone tło (ponieważ linear1 ma tło czerwone i ma właściwości do wypełnienia rodzica), a dwa inne układ z nad linear1 z zielonymi i niebieskimi bacgroudnsJak ustawić Linelayout w scrollview, aby wypełnić cały obszar?
ale co tak naprawdę widzę to czarno bacground z Scrollview i zielonym i niebieskim z linear2 i linear3 ale bez czerwonego backgrund z linear1
mianowicie liniowy zachowuje się jak android: layout_height = "wrap_content" to nie android: layout_height = "match_parent"
jakieś pomysły?
dzięki! to naprawdę działa – Amos
jak naprawić linearlayout z weightsum wewnątrz przewijania? – karthick