althaf_tvm
althaf_tvm

Reputation: 773

Android expandable list with scrollview

Is it possible to have a custom expandable list view in android with scrollview?

Upvotes: 0

Views: 3173

Answers (5)

Kenneth
Kenneth

Reputation: 94

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>  

Upvotes: 0

Jayson Tamayo
Jayson Tamayo

Reputation: 2811

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.

Upvotes: 1

Anand Sainath
Anand Sainath

Reputation: 1807

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.

Upvotes: 1

Mohit
Mohit

Reputation: 624

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

Upvotes: 1

Rohit Sharma
Rohit Sharma

Reputation: 13815

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.

Upvotes: 0

Related Questions