У меня есть следующий макет:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:text="Height"
android:layout_height="wrap_content"
android:id="@+id/buttonHeight"
android:layout_width="wrap_content"
android:layout_weight="15"
android:onClick="OnClickHeight">
</Button>
<Button
android:text="Width"
android:layout_height="wrap_content"
android:id="@+id/buttonWidth"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/buttonHeight"
android:layout_weight="1"
android:onClick="onClickWidth">
</Button>
</LinearLayout>
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:dividerHeight="1px"
android:drawSelectorOnTop="false"/>
</RelativeLayout>
Затем у меня есть класс, расширяющий ListActivity, в котором у меня есть методы onClickWidth и onClickHeight, например:
public void onClickWidth(View v)
{
// does stuff
}
Однако эти события onClick не обрабатываются. Если я изменю класс для расширения Activity вместо ListActivity, а также удалю ListView из моего макета, , а затем , это будет обнаружено!
Я попытался установить android: clickable = "true", поиграл с атрибутом android: focusable и многими другими вещами, но я просто не могу заставить это работать. Как я могу решить это, или это просто не разрешено?