Tengo un elemento de lista personalizado con botones para un ListView. Cuando se presiona, el botón muestra alternas dibujables para mostrar comentarios al usuario. Sin embargo, cuando hago clic en la fila, todos los botones muestran el estado presionado como si hubiera hecho clic en ellos.Cómo evitar el botón dentro de ListItem para resaltar
¿Cómo puedo mantener el botón muestra su estado original en lugar de state_pressed?
diseño/Lista de elementos:
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:descendantFocusability="blocksDescendants" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center_vertical|left" >
<TextView
android:id="@+id/txtMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
style="@style/PrimaryText" />
<TextView
android:id="@+id/txtSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
style="@style/SecondaryText" />
</LinearLayout>
<ImageButton
android:id="@+id/imbResponse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:focusable="false"
android:duplicateParentState="false"
android:src="@drawable/response_btn"
android:contentDescription="@string/response"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp" />
</LinearLayout>
estirable/response_btn.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:drawable="@drawable/res_m" />
<item android:state_pressed="true" android:drawable="@drawable/res_m" />
<item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/res_alt_m" />
</selector>
he intentado quitar state_focused y state_pressed, state_focused. Parece que el botón toma state_pressed de su padre.
¿Alguna suerte para encontrar una solución? – Sunkas