开发者

Android expandable list with scrollview

Is it possible to have a custom e开发者_JAVA百科xpandable list view in android with scrollview?


ListView already have scrollView associated with it, you can use MergeAdapter to achieve this


I don't think any of you got his question right! He is asking about the "expandable" list view. Anyways I also seem to be having the same doubt.

I still think the answer is NO.

You may be able to use custom views and them inflate them into an already existent layout element which will give you the same effect. And I think that solution will be better.


ExpandableListView has its own listview. You don't have to integrate another listview on it. Notice that if you have a long list, vertical scroll is associated automatically.


combination of listview withing scrollview is not happening to be good option. if you will place any listview within scroll view the listview will not scroll. Its seeming to be officialy said by google android programmer that this will be a bad user experience.


Of course, combination of expandable listview withing VERTICAL scrollview is not happening to be good option, but using it within HorizontalScrollView works impressive. I use this method in my program. User can horizontally scroll long strings.

    <?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
    android:id="@+id/RelativeView01"
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <Button
            android:id="@+id/btnSaveSelection"
            android:layout_alignParentLeft="true"
            android:layout_width="100dip"
            android:layout_height="50dip"
            android:layout_alignParentBottom="true"
            android:text="@string/SaveSelection"
            android:focusable="true"
            android:background="@drawable/android_button"
            android:onClick="myClickHandler14" />
        .........
<HorizontalScrollView 
    android:id="@+id/HorizontalScrollView01" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent"
    android:scrollbars="horizontal|vertical"
    android:layout_above="@id/button_add_group"
    android:layout_alignParentTop="true"> 
    <LinearLayout android:id="@+id/LinearLayout02" 
        android:layout_width="wrap_content" 
        android:orientation="vertical" 
        android:layout_height="wrap_content"> 
        <ExpandableListView android:id="@+id/android:list"
                android:layout_width="750px"
                android:layout_height="wrap_content"
                android:groupIndicator="@android:color/transparent" />
            <TextView android:id="@+id/android:empty"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#000000"
                android:text="@string/no_data"/>
    </LinearLayout>
</HorizontalScrollView>
</RelativeLayout>  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜