简体   繁体   English

相对布局和相对列表视图相对于滚动视图android

[英]relative layout and listview in relative which in scrollview android

There're an elements of textview, button and imageview..etc on the top of the layout,but the large of part has listview. 布局的顶部有textview,button和imageview..etc等元素,但是大部分都有listview。 It's required, when we scroll, top elemnts must scrolling too with listview. 这是必需的,当我们滚动时,顶级元素也必须使用listview滚动。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/com.revolage.vkcommunity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/vk_white"
android:orientation="vertical"
tools:context="com.egay.borsh.fragments.MainActivity" >

<RelativeLayout
    style="@style/ActionBarStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin" >

    <RelativeLayout
        android:id="@+id/action_bar_relative_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="@dimen/activity_vertical_margin" >

        ......
    </RelativeLayout>

    <com.costum.android.widget.PullAndLoadListView
        android:id="@+id/main_post_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/header_linear_layout" />
</RelativeLayout>

but so, nothing is scrolling. 但是,没有任何东西在滚动。

For this scenario you need to use an expandable ListView. 对于这种情况,您需要使用可扩展的ListView。 Its a list view thats always expanded. 它的列表视图多数民众赞成在扩大。 So you can put it inside ScrollView. 因此,您可以将其放在ScrollView中。 For your pullAndReflesh custom list view, you should check an expandable and extend your class from that. 对于您的pullAndReflesh自定义列表视图,您应该检查一个可扩展的对象并从中扩展您的类。 You can find this class on google. 您可以在Google上找到此类。

Why a listView inside scrollview? 为什么在listview里面有一个listView?

Because sometimes you need to use a adapter which cant be used with a LinearLayout for example. 因为有时您需要使用不能与LinearLayout一起使用的适配器。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM