【问题标题】:i want to display this listview on scrolling我想在滚动时显示这个列表视图
【发布时间】:2011-01-29 01:03:39
【问题描述】:

我完全被这个难住了。我需要在屏幕上显示三个不同的列表。 我尝试使用带有 LinearLayout 子级的 ScrollView,并将我的 ListViews 放在 LinearView 中,但是所有 ListViews 都使用滚动条锁定到固定高度。使用其他类型的布局意味着没有滚动。

【问题讨论】:

  • ListViews 知道如何滚动。您不必将其放在 Scrollview 中。画一幅画,告诉我们您想要实现的目标。
  • 您不仅不必将其放在ScrollView 中,而且在ScrollView 中也不起作用。

标签: android


【解决方案1】:

您的线性布局中列表视图的高度取决于您对它们的权重。

你有一些示例代码吗?

试试这个布局(未测试)

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="fill_parent"
android:height="fill_parent"
android:orientation="vertical"
>

<ListView
android:id="@+id/list1"
android:width="fill_parent"
android:height="fill_parent"
android:layout_weight="1"
>

<ListView
android:id="@+id/list2"
android:width="fill_parent"
android:height="fill_parent"
android:layout_weight="1"
>

<ListView
android:id="@+id/list3"
android:width="fill_parent"
android:height="fill_parent"
android:layout_weight="1"
>

</LinearLayout>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-21
    • 2012-05-26
    • 2011-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-17
    相关资源
    最近更新 更多