【问题标题】:How to set listviews in horizontalScrollView to fill up the screen?如何在 Horizo​​ntalScrollView 中设置列​​表视图以填满屏幕?
【发布时间】:2014-10-29 03:13:48
【问题描述】:

我在 Horizo​​ntalScrollView 中有三个列表视图。我想让它们中的每一个都占据整个屏幕,方法是将它们包含在一个设置为(layout_width:match_parent,layout_height:match_parent)的线性布局中。但是,它不起作用。正如您从屏幕截图中看到的那样,三个列表视图彼此紧密相连。

有什么建议可以让三个列表视图分别占据全屏吗?非常感谢。

<HorizontalScrollView
    android:id="@+id/horizontalScrollView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/page_bg_color">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <ListView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/tab_login_myFriends_requestList"
                android:background="#ffffffff" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <ListView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/tab_login_myFriends_pendingList"
                android:background="#ffffffff" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <ListView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/tab_login_myFriends_confirmedList"
                android:background="#ffffffff" />
        </LinearLayout>
    </LinearLayout>
</HorizontalScrollView>

【问题讨论】:

  • 占据整个屏幕是什么意思?你有 3 个列表视图?你想要一个类似的东西吗?等比例?

标签: android listview horizontalscrollview


【解决方案1】:

使用这个,

http://developer.android.com/reference/android/widget/ScrollView.html#attr_android:fillViewport

将其设置为 true。此外,您的列表视图可能应该具有与其关联的权重属性。

但我真的不知道你想做什么。也许提供xml,我会进一步指导你。

我想你要找的是这个,

http://developer.android.com/training/animation/screen-slide.html

【讨论】:

  • @Derekyy 看看我的回答
  • 是的,我正在寻找屏幕幻灯片。谢谢。现在阅读。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多