关于Android软键盘弹出,会把原来的界面挤上去的问题~~ 关于Android软键盘弹出,会把原来的界面挤上去的问题,这个问题,我记得前面不知道是在这里还是在eoe上看到过此问题,当时没有注意认真看,(真是个坏毛病啊),现在求教各位,但是我发现如果是TableLayout不会出现此类问题,为何,以及如何解决就是让软键盘出现在Activity最上层,不把我原来的View挤到嘴上面?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在eoe上找到了个帖子,说是要直接把高度设置死,不用 fill_parent 或者 wrap_content 属性。还有解决办法没?这种设定死的,最是麻烦了~ 不会啊 虽然我很菜 但是我记得我写在linearlayout里面的 edittext 或者 button 在使用软键盘的时候没有出现你说的这个情况啊,而且我的button还被键盘覆盖了呢 在我的印象里,Android似乎默认把键盘覆盖在屏幕上吧? 嗯,这个问题其实我有解决的办法了,只要把界面大小写死就可以,可是我现在有点怀疑是OPhone才会出这种问题,或者是OMS的出问题,我现在试试在Android下是否出现类似问题 Ophone没试过。不过好像Android确实是直接覆盖的吧 Android2.1 我也试过了,也会出现这个问题,昨天说不能连续回复了,我就没发上来 解决办法有的,就是直接写死大小,不要用 fill_parent 和 wrap_content ,这个为什么,不清楚,应该是自动默认的界面大小的话,弹出的界面就把自己的界面的位置挤掉了,写定大小就在前面覆盖了···期待指点~ 你界面底部的那几个按钮是不是用了RelativeLayout来强行定位底部了?那样的肯定是被挤上去了。你写到主体里就,虚拟键盘就会盖上去了。 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"><ScrollView android:id="@+id/Layout_Scroll" android:layout_width="fill_parent" android:layout_above="@+id/Layout_LinearButton" android:layout_height="80px" android:focusable="false"> <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_height="fill_parent" android:layout_width="fill_parent" android:focusable="false"><TextView android:layout_height="wrap_content" android:id="@+id/TextView16" android:layout_toRightOf="@+id/TextView15" android:layout_below="@id/TextView_bsRate" android:layout_width="wrap_content" android:textSize="12sp" android:paddingRight="10px"></TextView> </RelativeLayout> </ScrollView> <LinearLayout android:layout_height="wrap_content" android:orientation="horizontal" android:baselineAlignedChildIndex="1" android:gravity="bottom|fill_horizontal" android:layout_width="fill_parent" android:layout_gravity="center_vertical" android:layout_alignParentBottom="true" android:id="@+id/FXT_Layout_LinearButton"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="fill" android:gravity="center" android:id="@+id/Button_item"></Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="fill" android:gravity="center" android:id="@+id/Button_zst" ></Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" android:gravity="center" android:id="@+id/Button_refresh"></Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" android:gravity="center" android:id="@+id/Button_keyboard"></Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:id="@+id/Button_return" android:text="返回"></Button> </LinearLayout></RelativeLayout>代码主体就是这样,RelativeLayout中嵌套一个ScrollView和底下一排LinearLayout排的Button , 楼上说的写到主体里,是指去掉LinearLayout么,直接写在最外层RelativeLayout里么? 终于解决了,eoe上一高人指点在androidMainfest.xml文件中在此Activity中写入 android:windowSoftInputMode="adjustPan"解决,结贴~! 按照楼上的解决办法,还是挤上去,求高人指点。<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_height="fill_parent" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:paddingBottom="20dip" > <RelativeLayout android:id="@+id/readinfo" android:layout_height="wrap_content" android:background="#ff006666" android:layout_width="fill_parent"> <TextView android:layout_height="wrap_content" android:textSize="26px" android:id="@+id/sendName" android:layout_width="fill_parent"> </TextView> <TextView android:layout_height="wrap_content" android:id="@+id/sendTime" android:layout_below="@+id/sendName" android:layout_width="fill_parent"> </TextView> </RelativeLayout> <RelativeLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_below="@id/readinfo" > <TextView android:id="@+id/smsContent" android:layout_width="fill_parent" android:textSize="20sp" android:layout_height="fill_parent" > </TextView> </RelativeLayout> <RelativeLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentBottom="true"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="输入回复内容" android:layout_alignParentLeft="true" android:id="@+id/replyCon" android:layout_marginRight="70dip" androidMainfest.xml中:<activity android:name=".ReadSms" android:windowSoftInputMode="adjustPan" ></activity> 应该是没有捕捉到焦点,requestFocus()试试 android:windowSoftInputMode="adjustPan"在manifest里面加入此属性即可 如果使用了TabActivity可能需要在这个TabActivity的manifest文件中设置android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan"方法还是没解决 解决了 设置错Activity了 汗! 刚遇到了和LZ同样的问题,郁闷了一下午!现问题已解决!谢LZ.... 谢谢,问题已解决,但不知道为什么我的另一个Activity不用标记AdjustPan也是标记了的效果呢? 谢谢!原来这样!能否那里可以查到所有android:windowSoftInputMode这样的属性! 把项目中需要经常使用的常量全放在final class或者interface中声明是否合适 怎么读取android项目文件夹里的文件? android omap平台内核代码的编译问题 ,在线等 android开发 经常遇到 手机连接失败 或是offline 求ophone的屏保的设计思路或源码 agsxmpp 与android 之间的通信 求android播放网络gif图片的例子 关于webview的问题 Android TextView边界表情图片显示不全的问题 看不懂!!! android如何加入文字跟图片? android如何在绘制楼盘表
嗯,这个问题其实我有解决的办法了,只要把界面大小写死就可以,可是我现在有点怀疑是OPhone才会出这种问题,或者是OMS的出问题,我现在试试在Android下是否出现类似问题
不过好像Android确实是直接覆盖的吧
Android2.1 我也试过了,也会出现这个问题,昨天说不能连续回复了,我就没发上来 解决办法有的,就是直接写死大小,不要用 fill_parent 和 wrap_content ,这个为什么,不清楚,应该是自动默认的界面大小的话,弹出的界面就把自己的界面的位置挤掉了,写定大小就在前面覆盖了···期待指点~
你写到主体里就,虚拟键盘就会盖上去了。
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ScrollView android:id="@+id/Layout_Scroll"
android:layout_width="fill_parent" android:layout_above="@+id/Layout_LinearButton"
android:layout_height="80px" android:focusable="false"> <RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:focusable="false">
<TextView android:layout_height="wrap_content" android:id="@+id/TextView16"
android:layout_toRightOf="@+id/TextView15"
android:layout_below="@id/TextView_bsRate"
android:layout_width="wrap_content" android:textSize="12sp"
android:paddingRight="10px"></TextView>
</RelativeLayout>
</ScrollView> <LinearLayout android:layout_height="wrap_content"
android:orientation="horizontal" android:baselineAlignedChildIndex="1"
android:gravity="bottom|fill_horizontal" android:layout_width="fill_parent"
android:layout_gravity="center_vertical"
android:layout_alignParentBottom="true" android:id="@+id/FXT_Layout_LinearButton">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_gravity="fill" android:gravity="center"
android:id="@+id/Button_item"></Button>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_gravity="fill" android:gravity="center" android:id="@+id/Button_zst"
></Button>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_gravity="center_vertical" android:gravity="center" android:id="@+id/Button_refresh"></Button>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_gravity="center_vertical"
android:gravity="center" android:id="@+id/Button_keyboard"></Button>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:gravity="center" android:id="@+id/Button_return"
android:text="返回"></Button> </LinearLayout>
</RelativeLayout>代码主体就是这样,RelativeLayout中嵌套一个ScrollView和底下一排LinearLayout排的Button , 楼上说的写到主体里,是指去掉LinearLayout么,直接写在最外层RelativeLayout里么?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingBottom="20dip"
>
<RelativeLayout
android:id="@+id/readinfo"
android:layout_height="wrap_content"
android:background="#ff006666"
android:layout_width="fill_parent">
<TextView
android:layout_height="wrap_content"
android:textSize="26px"
android:id="@+id/sendName"
android:layout_width="fill_parent">
</TextView>
<TextView
android:layout_height="wrap_content"
android:id="@+id/sendTime"
android:layout_below="@+id/sendName"
android:layout_width="fill_parent">
</TextView>
</RelativeLayout>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_below="@id/readinfo"
>
<TextView android:id="@+id/smsContent"
android:layout_width="fill_parent"
android:textSize="20sp"
android:layout_height="fill_parent" >
</TextView>
</RelativeLayout>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="输入回复内容"
android:layout_alignParentLeft="true"
android:id="@+id/replyCon"
android:layout_marginRight="70dip"
androidMainfest.xml中:<activity android:name=".ReadSms"
android:windowSoftInputMode="adjustPan"
></activity>
应该是没有捕捉到焦点,requestFocus()试试
在manifest里面加入此属性即可
如果使用了TabActivity可能需要在这个TabActivity的manifest文件中设置android:windowSoftInputMode="adjustPan"