本文介紹了Android - 軟鍵盤將我的活動布局推到屏幕外的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時送ChatGPT賬號..
我的activity的布局如下圖.
My activity's layout is as shown below.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout android:id="@+id/title_bar"
android:layout_width="fill_parent"
android:layout_height="25dip"
android:background="@drawable/bg_title" />
<LinearLayout android:id="@+id/main"
android:width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<ListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<TextView android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dip" >
<EditText android:id="@+id/query"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Enter some search terms"
android:singleLine="true"
android:layout_weight="1" />
<Button android:id="@+id/btn_hide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_hide"
android:layout_marginLeft="6dip" />
</LinearLayout>
</LinearLayout>
因此,搜索框固定在屏幕底部.
So, the search box is fixed to the bottom of the screen.
但是,當用戶單擊 EditText 時,軟鍵盤會出現(xiàn)并將布局推出屏幕之外,搜索框除外.
But, when user clicks the EditText, Soft Keyboard shows up and pushes the layout out of the screen except the search box.
我剛剛開始使用 Android,所以我在這里做錯了嗎??
I'm just starting out with Android, so am I doing anything wrong here??
推薦答案
嘗試在 Manifest 中為您的活動添加以下內(nèi)容:
Try adding the following for your activity in Manifest:
android:windowSoftInputMode="adjustPan"
這篇關(guān)于Android - 軟鍵盤將我的活動布局推到屏幕外的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!