Android(4及更高版本)键盘使可见按钮无法点击

时间:2012-10-05 19:35:37

标签: android keyboard

当我点击Edittext时,会出现键盘。当键盘打开时,有一个按钮仍然可见,但它不可点击。只有当您点击“后退”按钮和键盘消失时,您才可以单击该按钮。即使键盘可见,我希望能够单击该按钮。这个问题只适用于4个以上的Android版本,旧版本的一切都很好。

即使键盘弹出,如何才能使可见按钮可点击?

以下是代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:mm="http://millennialmedia.com/android/schema"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ImageView android:id="@+id/topLogo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:contentDescription="@string/logo_desc"
    android:src="@drawable/top_logo" />      

<EditText
    android:id="@+id/searchField"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_below="@+id/topLogo"
    android:inputType="textPersonName" >
</EditText>   

<Button
    android:id="@+id/searchButton"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/searchField"
    android:layout_centerHorizontal="true"
    android:text="@string/search_button_label"  />        

</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

变身自己<com.millennialmedia.android.MMAdView/>造成了问题。与所有其他组件在同一RelativeLayout中。将MMAdView放入主布局内的另一个布局解决了这个问题。