Hi All,

So I have this issue with ExpandableListViews I don't quite
understand. I'm having the exact issue as this person almost a year
ago but I'm seeing the solution is not really clear:

http://groups.google.com/group/android-developers/browse_thread/thread/4fcd6fed2799fb7d/e10af5934b98baf0?lnk=gst&q=expandable+list+view#e10af5934b98baf0

Basically I wanted my groups to have a TextView on the left and a
Button on the Right. What's happening is I get my custom View, but it
becomes unclickable (basically onGroupClick doesn't get called):
        // from my custom BaseExpandedListAdapter
        public View getGroupView(int groupPosition, boolean
isExpanded, View convertView,
                ViewGroup parent) {

                GroupItemHolder grpItemHolder;

                if(convertView == null){
                        convertView = 
inflator.inflate(R.layout.trends_group_item,
null);

                        grpItemHolder = new GroupItemHolder();
                        grpItemHolder.title = (TextView)
convertView.findViewById(R.id.trends_group_title);
                        grpItemHolder.dataBtn = (Button)
convertView.findViewById(R.id.trends_group_btn);

                        convertView.setTag(grpItemHolder);
                }
                else{ // quick access
                        grpItemHolder = (GroupItemHolder) convertView.getTag();
                }

            return convertView;

            // the bottom code from APIDemos ExpandableListView1.java,
generic, works
            /*TextView textView = getGenericView();
            textView.setText(getGroup(groupPosition).toString());
            return textView;*/
        }

The commented out code is from the APIDemo ExpandableListView1.java.
It works with that genericView but obviously I want to create a custom
group. Can anyone tell me why my group becomes unclickable? Is is
because convertView is taking up the entire groupView so clicks can't
be detected? Linked below is trends_group_item.xml that was inflated:

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

  <!-- Contains what a group item will contain to be used in
ExpListAdapter -->
  <TextView
        android:id="@+id/trends_group_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:paddingLeft="10dip"
        android:text="null" />

  <Button
        android:id="@+id/trends_group_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:paddingRight="10dip"
        android:text="null" />

</RelativeLayout>

Thanks in Advance,
~Michael


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to