0
我有一个类扩展了ListActivity。里面有3个按钮和一个列表视图(可点击的项目),列表项和2个按钮工作正常,但没有响应点击(其创建方式与其他方式完全相同)。我认为这是与按钮的可聚焦性相关的东西,我已经尝试过android:focusable =“true”和“false”,但没有任何变化。1个listview和3个按钮。 1按钮不可点击,为什么?
这是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@android:id/list"
android:layout_below="@+id/checkall"
android:layout_width="match_parent"
android:layout_height="400dp" >
</ListView>
<Button
android:id="@+id/checkall"
android:layout_height="38dp"
android:layout_width="wrap_content"
android:layout_marginLeft="19dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:text="Seleccionar todos"
android:background="#D1D1D1" />
<Button
android:id="@+id/uncheckall"
android:layout_height="38dp"
android:layout_width="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/checkall"
android:layout_alignParentTop="true"
android:text="Borrar selección"
android:background="#D1D1D1"
android:layout_alignParentRight="true" />
//this is the one not accepting clicks -->
<Button
android:id="@+id/mostrar"
android:layout_height="49dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:text="Mostrar en mapa"
android:background="#D1D1D1" />
</RelativeLayout>
在所有按钮中添加android:clickable =“true”android:focusable =“false”请尝试这个 – 2014-10-08 14:00:44
并请告诉我发生了什么事情它已经起作用 – 2014-10-08 14:01:24
我不是e onClick =“...”任何地方。你如何指定被调用的内容?你是否为最后一个按钮指定了它? – 18446744073709551615 2014-10-08 14:01:30