Note that there are some explanatory texts on larger screens.

plurals
  1. POImageButton in group row of ExpandableListView causing onClickListener not to be fired
    primarykey
    data
    text
    <p>I am working with an ExpandableListView in my application. It worked fine until I decided to add an ImageButton to the end of it. Here is my XML:</p> <p>This is my group row: </p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="1"&gt; &lt;TextView android:text="location" android:layout_height="45dp" android:layout_width="250dp" style="@style/listResultsTitle" android:id="@+id/results_location_row" android:gravity="center_vertical" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginLeft="40dp"&gt; &lt;/TextView&gt; &lt;TextView android:text="ad" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_height="30dp" android:layout_width="wrap_content" style="@style/listResults" android:id="@+id/results_ad_row" android:layout_alignBottom="@+id/results_location_row" android:layout_alignLeft="@+id/results_location_row" android:layout_alignRight="@+id/results_location_row"&gt; &lt;/TextView&gt; &lt;ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/prox_order" android:src="@drawable/ic_menu_add" android:background="@android:color/transparent" android:layout_centerVertical="true" android:layout_alignParentRight="true"&gt; &lt;/ImageButton&gt; </code></pre> <p>Now, the ExpandableListView will not expand. Does anyone know what the problem could be? </p> <p>EDIT: Okay, I understand what the problem is. I have a view that is focusable that causes the onItemClickListener not to be called when I click on a row. I implemented an onClickListener that captures the click, but I do not know how to expand the row. Can anyone help out? Here is the code that I have inside of my custom Adapter: </p> <pre><code> v.setOnClickListener(new OnItemClickListener(groupPosition, this)) private class OnItemClickListener implements OnClickListener{ private int pos; MySimpleExpandableListAdapter adapter; OnItemClickListener(int groupPosition, MySimpleExpandableListAdapter _adapter){ pos = groupPosition; adapter = _adapter; } @Override public void onClick(View v) { Log.e("Adapter", "Row clicked: #" + String.valueOf(pos)); } } </code></pre> <p>~Nemisis7654</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload