Bingding with ExpandableListView

125 views
Skip to first unread message

Albert

unread,
Aug 13, 2012, 7:03:40 PM8/13/12
to android...@googlegroups.com
Hi Mr.Andy

i have build small example about binding with ListView and it's work nice
this is my xml code
<ListView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        binding:itemSource="ADAPTER({source=persons, template=@layout/list_item})"/>

but when i try to bind with ExpandableListView
like :
<ExpandableListView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        binding:itemSource="ADAPTER({source=persons, template=@layout/list_item})"/>

the binding doesn't work ...
why ?? and how can i do this ??
thanks

Andy Tsui

unread,
Aug 13, 2012, 8:18:58 PM8/13/12
to android...@googlegroups.com
Expandable list view is very different from list view, since their adapter is actually different... Please look at the example from Markup Demo for how to use expandable list view.

kartik...@gmail.com

unread,
Jul 18, 2013, 10:24:43 AM7/18/13
to android...@googlegroups.com
Hi andy ,

I m using ExpandableListView in which i want to have two - three textviews when expanded. In child.xml i added two textviews with binding:text="text1" and binding:text="text2" .but when i try to expand the view no value appear - it appears blank . In log it says 

07-18 19:32:12.769: E/Binder(7779): AttributeBinder.bindAttributeWithObservable() : Error when resolving statement 'text1'
07-18 19:32:12.769: E/Binder(7779): AttributeBinder.bindAttributeWithObservable() : Error when resolving statement 'text2'


I reffered you Markup Demo. there in child_template.xml there is only textview where binding:text=".". What to do for multiple textviews.. ?


child.xml ------------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            binding:text="text1" />


          
<TextView

            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            binding:text="text2" />

        
    </LinearLayout>

</LinearLayout>



master_template.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:textSize="21sp"
        binding:text="Title" />

</LinearLayout>

Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

   

    <ExpandableListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        binding:childItemSource="'DetailsChild'"
        binding:childItemTemplate="@layout/child"
        binding:itemSource="GroupItemsMaster"
        binding:itemTemplate="@layout/master_template" />

</LinearLayout>

kartik...@gmail.com

unread,
Jul 18, 2013, 10:25:10 AM7/18/13
to android...@googlegroups.com

Andy Tsui

unread,
Jul 18, 2013, 10:45:25 AM7/18/13
to android...@googlegroups.com, kartik...@gmail.com
Can you post your VMs here as well?
Reply all
Reply to author
Forward
0 new messages