关于Android软键盘弹出,会把原来的界面挤上去的问题,这个问题,我记得前面不知道是在这里还是在eoe上看到过此问题,当时没有注意认真看,(真是个坏毛病啊),现在求教各位,但是我发现如果是TableLayout不会出现此类问题,为何,以及如何解决
就是让软键盘出现在Activity最上层,不把我原来的View挤到嘴上面??
就是让软键盘出现在Activity最上层,不把我原来的View挤到嘴上面??
调试欢乐多
嗯,这个问题其实我有解决的办法了,只要把界面大小写死就可以,可是我现在有点怀疑是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"