Мой сценарий выглядит так: У меня есть линейная компоновка, в которой у меня есть один вид изображения и около 10 editTexts. Я хочу, чтобы ImageView составлял половину размера экрана, а оставшиеся тексты редактирования занимали остальную часть пространства и, если нужно, прокручивали прокрутку.Android layout_weight для переполнения линейной высоты макета
Я завернул свою линейную компоновку в виде прокрутки и назначил сумму веса 10 на линейный макет. Затем назначенный layout_weight из 5 в imageView и остальное все остались с layout_height of wrap_content. Но это полностью скрывает изображение. Как мне получить вид макета, который я хочу?
Мой layout.xml:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="10dp"
android:id="@+id/imageView" android:layout_gravity="center" android:background="#bcddff"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Launch Camera"
android:id="@+id/button" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Enter Name"
android:id="@+id/name" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Mobile No."
android:id="@+id/mobile" android:layout_gravity="center" android:inputType="phone"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Whatsapp No."
android:id="@+id/whatsapp" android:layout_gravity="center" android:inputType="phone"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:id="@+id/email" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Age"
android:id="@+id/age" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:id="@+id/address" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="City"
android:id="@+id/city" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="State"
android:id="@+id/state" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Gender(M/F)"
android:id="@+id/gender" android:layout_gravity="center"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Remarks"
android:id="@+id/remarks" android:layout_gravity="center"/>
</LinearLayout>
</ScrollView>
http://stackoverflow.com/questions/17330216/layout-weight-does-not-work-when-the-layout-inside-a-scrollview-is- больше, чем т –