整個佈局推時鍵盤彈出。 XML文件包含的ListView 以及其下的兩個按鈕,當鍵盤彈出式菜單都ListView和按鈕推。佈局推時,鍵盤彈出式菜單
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.athis.buy.HomeScreen">
<SearchView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ListView
android:id="@+id/list_item"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_weight="8"
android:divider="#ffffff"
android:dividerHeight="10dp"
android:padding="5dp" />
<LinearLayout
android:id="@+id/buttons"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#a8b3ff"
android:gravity="bottom"
android:orientation="horizontal"
android:weightSum="100">
<Button
android:id="@+id/filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginStart="10dp"
android:layout_weight="50"
android:text="Filter"
android:layout_marginBottom="2dp"/>
<Button
android:id="@+id/sort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:layout_marginStart="5dp"
android:layout_weight="50"
android:text="Sort"
android:layout_marginBottom="2dp"/>
</LinearLayout>
</LinearLayout>
我已經加入Android的:在清單windowSoftInputMode =「stateHidden」所以,當我觸摸的EditText只有鍵盤應該彈出
那麼簡單的解決方案,謝謝。 –