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