[問題]此layout會導致button無法觸發onClick嗎?
layout的xml如下,裡面的button無論是
OnTouch、OnFocusChange、OnClick皆無法觸發..
爬過一些文章說是OnTouch、OnClick同時存在時,
OnTouch一定要return false這樣OnClick才能觸發,
我照做了也確保return false,但button還是無法觸發這三項......
請問是因為我在RelativeLayout設定focusable、focusableInTouchMode的緣故嗎?
感謝各位高手協助!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/test_layout"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textSize="30dp"
android:layout_marginTop="19dp"
android:text="@string/num" />
<ListView
android:id="@+id/listView1"
android:layout_width="285dp"
android:layout_height="200dp"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp" >
</ListView>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="36dp"
android:text="@string/ok" />
</RelativeLayout>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.224.92.190
推
07/18 18:13, , 1F
07/18 18:13, 1F
→
07/18 18:25, , 2F
07/18 18:25, 2F
→
07/18 21:47, , 3F
07/18 21:47, 3F
→
07/18 21:48, , 4F
07/18 21:48, 4F
→
07/18 21:48, , 5F
07/18 21:48, 5F