1

私は WebView とその右上隅の上にあるボタンを持っています。私の問題は、ボタンを最初にタップしたときに機能せず、2 回目のタップ (クリック) が正常に機能することです。

そのxmlは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
        android:layout_marginTop="10dp"
        android:layout_marginRight="4dp"
        android:layout_marginBottom="4dp"
        android:layout_marginLeft="4dp"
        android:background="@drawable/popup3"    
        >
    <WebView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/webviewActionView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:minHeight="200dp"
        android:minWidth="200dp"
        android:scrollbars="none" >
    </WebView>
    </LinearLayout>
    <Button
        android:id="@+id/popup_closer"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="0dip"
        android:layout_marginLeft="0dip"
        android:background="@drawable/close_popup"
        android:clickable="true"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:text=" " />     
</RelativeLayout>

次のようになります。ここをクリック

コードで LinearLayout の前に ButtonView を配置すると、最初のクリック (タップ) から機能します。

しかし、それはこのように見えます:ここをクリック

4

1 に答える 1

2

試す

            android:focusable="true"
            android:focusableInTouchMode="true"

削除するか、false に設定します。

于 2013-01-06T17:53:41.637 に答える