简体   繁体   English

如何在horizo​​ntalScrollView中设置列表视图以填满屏幕?

[英]How to set listviews in horizontalScrollView to fill up the screen?

I have three listviews in horizontalScrollView. 我在horizo​​ntalScrollView中有三个列表视图。 I want to make each of them to occupy the full screen, by including them into a linearlayout which is set to (layout_width: match_parent, layout_height: match_parent). 我想通过将它们包含到设置为(layout_width:match_parent,layout_height:match_parent)的linearlayout中,使它们各自占据全屏。 However, it doesn't work. 但是,它不起作用。 As you see from the screenshot, the three listviews just tightly linked with one another. 从屏幕截图中可以看到,三个列表视图彼此紧密链接。

Any suggestions so that the three listviews each occupies the full screen? 有什么建议可以使三个列表视图全屏显示吗? THx a lot. 多谢。

在此处输入图片说明

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

Use this, 用这个,

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

Set that to true. 将其设置为true。 Also your listviews should probably have a weight attribute associated with them. 另外,您的列表视图可能应该具有与之关联的weight属性。

But I can't really figure out what you're trying to do. 但是我真的无法弄清楚您要做什么。 Maybe provide the xml and I'll guide you further. 也许提供xml,我会进一步指导您。

I think what you're looking for is this, 我认为您正在寻找的是

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android中设置Horizo​​ntalScrollView? - How to set up a HorizontalScrollView in Android? horizo​​ntalscrollview设置子元素以填充horizo​​ntalscrollview宽度 - horizontalscrollview set child elements to fill horizontalscrollview width Horizo​​ntalScrollView用ScrollView填充整个屏幕 - HorizontalScrollView fill entire screen with ScrollView 设置Horizo​​ntalScrollView的约束 - Set up constraints for HorizontalScrollView 如何在Horizo​​ntalScrollView的最右侧设置FrameLayout - How to set up FrameLayout to the far right side in HorizontalScrollView 如何让我的 Horizo​​ntalScrollView 的孩子在不重叠的情况下填满屏幕? - How do I get the children of my HorizontalScrollView to FILL THE SCREEN while still not overlapping each other? 如何在Horizo​​ntalScrollView中将焦点设置为Textview? - How to set focus to Textview in HorizontalScrollView? 如何从Horizo​​ntalScrollView中获取屏幕宽度 - How to get screen width from within a HorizontalScrollView 如何在具有多个ListViews的活动中为ListViews设置一个空视图? - How do I set an empty view for ListViews in an activity with multiple ListViews? 如何设置LinearLayout背景图像以填充屏幕 - How to set LinearLayout background image to fill the screen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM