问题描述
|
当软键盘在adjustResize模式下出现时,我的编辑文本消失。有相对布局,其中自定义视图在孔屏幕尺寸上作为背景延伸,并且在其上方很少有编辑文本。在adjustPan模式下,所有功能都可以正常工作,但是键盘后面看不到editetext。所有布局设置都是硬编码的,没有xml。如果我没有背景视图建立它一切正常。
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\" >
<com.mypkg.Panel android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\" android:id=\"@+id/panel\"
android:layout_alignParentTop=\"true\"
android:layout_alignParentLeft=\"true\"></com.mypkg.Panel>
<EditText android:layout_height=\"wrap_content\"
android:layout_width=\"wrap_content\" android:id=\"@+id/edit1\"
android:layout_alignParentBottom=\"true\" android:layout_marginBottom=\"23dp\"
android:layout_alignParentRight=\"true\" android:layout_alignParentLeft=\"true\">
</EditText>
</RelativeLayout>
class Panel extends SurfaceView implements SurfaceHolder.Callback {...
解决方法
将整个布局放在within1内。使用ScrollView时,启用软键盘后,您的布局就会向上滚动或能够向上滚动(取决于设备)。
[编辑]
帖子下方的评论摘要:按照本文档的建议,将布局文件夹用于ldpi,mdpi和hdpi。
[/编辑]