Android的 - 软键盘推我的活动布置了屏幕 [英] Android - Soft Keyboard pushes layout of my activity out of screen

查看:170
本文介绍了Android的 - 软键盘推我的活动布置了屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的活动的布局如下图所示。

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,软键盘显示出来,并推动布局在屏幕,除了搜索框。

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??

推荐答案

尝试添加如下,供大家在清单活动:

Try adding the following for your activity in Manifest:

android:windowSoftInputMode="adjustPan"

这篇关于Android的 - 软键盘推我的活动布置了屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆