如何在horizo​​ntalScrollView中设置listviews以填满屏幕?

时间:2014-10-29 03:13:49

标签: android listview horizontalscrollview

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

有任何建议,以便三个列表视图分别占据全屏吗?太多了。

enter image description here

<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>

1 个答案:

答案 0 :(得分:1)

使用此,

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

将其设置为true。您的列表视图也应该具有与之关联的权重属性。

但我无法弄清楚你想要做什么。也许提供xml,我会进一步指导你。

我认为你要找的是这个,

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