在我的 Activity 中,当我在操作栏中按下搜索时,软键盘会出现,这是预期的,但问题是我在底部有一个 float 操作按钮,它也会出现,如下所示。这个怎么解决。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true" >
<ListView android:id="@android:id/list"
style="?android:attr/listViewWhiteStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<ImageButton
android:id="@+id/floating_action_button"
android:layout_width="@dimen/floating_action_button_width"
android:layout_height="@dimen/floating_action_button_height"
android:layout_marginBottom="@dimen/floating_action_button_margin_bottom"
android:layout_gravity="bottom|center_horizontal"
android:background="@drawable/floating_action_button"
android:src="@drawable/ic_messaging_new_message"
/>
</FrameLayout>
最佳答案
尝试在 list 的 Activity 标签中提供 android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"
或 android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
。
关于Android float 操作按钮出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29774323/