开发者

Android: edittext disappearing

When soft keyboard appears in adjustResize mode, my edittext disappears. There is relativelayout with custom view stretched on the hole screen size as background and few edittexts over it. In adjustPan mode all works fine but you can't see editetext behind keyboard. All layout settings are hardcoded, there no xml. If i build it without background view all works fine.

 <?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开发者_JAVA技巧_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 {...


Put your whole layout within a ScrollView. With a ScrollView your Layout will be scrolled up or is able to scroll up (depending on the device) once the soft keyboard is enabled.

[Edit]

Summary of the comments below this post: Use the layout folders for ldpi, mdpi and hdpi as proposed by this documentation.

[/Edit]


<activity android:windowSoftInputMode="adjustPan"> </activity>

Add this line to your AndroidManifest.xml. Worked for me! :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜