Итак, у меня есть макет, содержащий ListView ... и под ListView у меня есть разные другие элементы ... моя проблема в том, что если ListView получает много элементов, то элементы из дно исчезает с экрана .... Как я могу это решить?Android layout_below способ работы
Моя раскладка:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<TextView android:id="@+id/name_header"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginLeft="10sp"
android:layout_marginTop="5sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:text="@string/product"
/>
<TextView android:id="@+id/quantity_header"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="5sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="@string/quantity"
android:gravity="center"
/>
<TextView android:id="@+id/total_price_header"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="5sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="@string/price"
android:gravity="center"
/>
</LinearLayout>
<View android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#FF0000"
android:layout_below="@+id/header"
/>
<ListView
android:id="@+id/listViewOrder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/line"
android:layout_marginTop="10sp"
android:layout_centerHorizontal="true" >
</ListView>
<View android:id="@+id/line2"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#FF0000"
android:layout_marginTop="10sp"
android:layout_below="@+id/listViewOrder"
/>
<TextView android:id="@+id/total_cost"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="5sp"
android:layout_marginBottom="15sp"
android:layout_marginRight="5sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_below="@+id/line2"
/>
<RadioGroup android:id="@+id/radio"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@+id/total_cost">
<RadioButton android:id="@+id/radio_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/radio_home"
android:layout_marginRight="20sp"
android:onClick="onRadioButtonClicked"
/>
<RadioButton android:id="@+id/radio_work"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/radio_work"
android:onClick="onRadioButtonClicked"
/>
</RadioGroup>
</RelativeLayout>
Благодаря
EDIT: Проблема была в моем approach..what мне нужен был TableLayout ... и элемент снаружи, чтобы быть ScrollView
ваш подход заставляет мой список «заставлять его в оставшееся пространство» ... я бы хотел, чтобы он был с нормальным размером ... и если этот размер слишком велик, чтобы прокрутить экран. .если это возможно :) – Teshte
Тогда вам не нужен вид списка. Представление списка представляет собой прокручиваемое представление с бесконечными строками, которое интеллектуально управляет этими строками, так что только n можно просматривать одновременно. Создание всего прокручиваемого экрана с помощью LV, прокручиваемого внутри него, повредило бы все. Что вы хотите использовать TableLayout и программно добавить 1 строку за элемент вместо listView. Вы используете список, чтобы экран не прокручивался. –
, так что в основном вы говорите, чтобы использовать таблицу ta вместо listView? Я попробую это решение .. и вернусь с вашей наградой, если это сработает :) – Teshte