0
我有一个ListView外的按钮和按钮点击(onClickListener)不起作用。我试过android:focus =“false”,android:descendantFocusability =“blocksDescendants”,但我不知道我是否正确使用它。完全没有工作。我是Android的初学者,请帮我修复它。谢谢。在ListView外部定义的按钮不能正常工作
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false">
<Button
android:text="Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/b1"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView1"/>
</LinearLayout>
按钮正在出现,但它不能识别Click(onClickListener无效)。 – Shreesha
好吧然后发布你的onclicklistener code.So,我可以理解错误的地方。 – EED