Я работаю с ExpandableListView в моем приложении.Он работал нормально, пока я не решил добавить ImageButton в конце.Вот мой XML:
Это строка моей группы:
<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">
<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">
</TextView>
<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">
</TextView>
<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">
</ImageButton>
Теперь ExpandableListView не будет расширяться.Кто-нибудь знает, в чем может быть проблема?
РЕДАКТИРОВАТЬ: Хорошо, я понимаю, в чем проблема.У меня есть представление, которое является фокусируемым, что заставляет onItemClickListener не вызываться, когда я щелкаю по строке.Я реализовал onClickListener, который фиксирует щелчок, но я не знаю, как развернуть строку.Кто-нибудь может помочь?Вот код, который у меня есть внутри моего пользовательского адаптера:
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));
}
}
~ Nemisis7654