У меня есть 4 listViews
, которые устанавливаются динамически. Мой контент превышает размер экрана, поэтому я не могу показать весь контент.Несколько listView в линейной компоновке Android
Это то, на что похоже в linearLayout
Имейте ввиду, что «баннер»/изображение изменится в зависимости от списка. Должно быть 4. По какой-то причине только нижний список, как вы можете видеть, может прокручиваться. (Не то, что я хочу)
А вот xml
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvSponsors"
android:layout_gravity="left|center_vertical"/>
<!--Gold-->
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvGold"
android:layout_gravity="left|center_vertical"/>
<!--Silver-->
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvSilver"
android:layout_gravity="left|center_vertical"/>
<!--Bronze-->
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvBronze"
android:layout_gravity="left|center_vertical"/>
</LinearLayout>
И если я поставил точку зрения корень к scrollView
я получаю это;
И мой xml
для вида прокрутки
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/chainlink">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvSponsors"
android:layout_gravity="left|center_vertical"/>
<!--Gold-->
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvGold"
android:layout_gravity="left|center_vertical"/>
<!--Silver-->
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvSilver"
android:layout_gravity="left|center_vertical"/>
<!--Bronze-->
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/platinumhead"/>
<ListView
android:layout_margin="8sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lvBronze"
android:layout_gravity="left|center_vertical"/>
</LinearLayout>
</ScrollView>
Мое содержание, очевидно, слишком большой для экрана, так что я буду нуждаться в ScrollView
, что бы прокрутить всю страницу одновременно. Как мне исправить мои xml
или java
?
1. Несколько списков просмотров один за другим - это не очень хорошая идея. Найдите способ объединить их в один список. Если нет способа сделать это, то, возможно, подумайте о том, чтобы списки были бок о бок в ViewPager. 2. Не помещайте ListView внутри ScrollView и наоборот, они будут бороться друг с другом за события касания, и ваш пользовательский интерфейс будет иметь проблемы. – Karakuri