У меня есть ListView и адаптер для обработки событий щелчка:
Это макет для элемента «Row» в ListView:
(При включении ImageButton в этомРасположение строки для всего элемента ListView становится невыбираемым, в то время как вы можете выбрать ImageButton,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/clocklistbackgroundnopadding"
android:gravity="fill_horizontal"
android:orientation="horizontal" >
<Button
android:id="@+id/timer_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@color/green"
android:focusable="false"
android:focusableInTouchMode="false"
android:padding="20dp"
android:text="+"
android:textSize="29sp" />
<!--
ImageButton
android:id="@+id/timer_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="false"
android:background="@color/red"
android:padding="30dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:src="@drawable/clocklistdetaildisclosure2" /
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_horizontal|bottom"
android:maxHeight="90dp"
android:maxWidth="90dp"
android:minWidth="50dp"
android:padding="4dip"
android:singleLine="true"
android:textSize="21sp" />
</RelativeLayout>
, однако обычная кнопка может быть добавлена без каких-либо проблем с возможностью выбора кнопки и элемента ListView.