ska*_*ria 11 keyboard hidden android hide android-edittext
在写这个问题之前,我已经阅读了以下答案/文章:
Android软键盘默认设置为平移,这意味着它将保持键盘上方的所有可编辑区域.然而,它不泛不够.当我运行它并按下靠近屏幕底部的edittext时,键盘出现并且edittext向上移动但不足以查看其中键入的内容.我用过/试过以下内容:
android:windowSoftInputMode="adjustPan"在活动的清单中.这没有任何区别.我也试图把价值观adjustUnspecified和adjustResize太.它们都不起作用.
<uses-sdk android:minSdkVersion="3" />在清单文件中.我的应用程序针对sdk 2.1及更高版本.尽管如此,我尝试过它并没有奏效.
使用ScrollView.也不起作用.
有没有办法手动管理按下特定编辑文本时键盘执行多少"平移".
下面是我的xml文件.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff">
<ImageView
android:id="@+id/header"
android:layout_width="320dip"
android:layout_height="86dip"
android:background="@drawable/header_bg">
</ImageView>
<ImageView
android:layout_width="320dip"
android:layout_height="200dip"
android:layout_alignParentBottom="true"
android:background="@drawable/bg1_btm">
</ImageView>
<TextView android:text="Hostname"
android:id="@+id/lbl_hostname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/header"/>
<TextView android:text="(Current)"
android:id="@+id/lbl_hostname_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/lbl_hostname"
android:layout_below="@id/header" />
<EditText android:text="EditText"
android:id="@+id/editText_hostname"
android:layout_below="@id/lbl_hostname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="25">
</EditText>
<TextView android:text="Registration URL"
android:id="@+id/lbl_registration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_hostname" />
<TextView android:text="(Current)"
android:id="@+id/lbl_registration_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_hostname"
android:layout_toRightOf="@id/lbl_registration" />
<TextView android:text="http://"
android:id="@+id/lbl_url_prefiz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lbl_registration"
android:paddingTop="10dip" />
<EditText android:text="EditText"
android:id="@+id/editText_registration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf ="@id/lbl_url_prefiz"
android:layout_below="@id/lbl_registration">
</EditText>
<TextView android:text="Chat"
android:id="@+id/lbl_chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_registration"/>
<TextView android:text="(Current)"
android:id="@+id/lbl_chat_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_registration"
android:layout_toRightOf="@id/lbl_chat"/>
<EditText android:text="EditText"
android:id="@+id/editText_chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lbl_chat">
</EditText>
<TextView android:text="SSID"
android:id="@+id/lbl_ssid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_chat" />
<TextView android:text="(Current)"
android:id="@+id/lbl_ssid_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_chat"
android:layout_toRightOf="@id/lbl_ssid"
/>
<EditText android:text="EditText"
android:id="@+id/editText_ssid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lbl_ssid"
android:maxLines="1"
android:inputType="text"
android:layout_marginBottom="25dip">
</EditText>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ButtonSave"
android:text="Save"
android:layout_below="@id/editText_ssid"
android:layout_alignParentLeft="true">
</Button>
<Button android:text="Continue"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/ButtonContinue"
android:layout_below="@id/editText_ssid"
android:layout_alignParentRight="true">
</Button>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
尝试使用fill_parent或match_parent设置所有控件布局高度和宽度...而不是使用硬编码值...
如果你使用它也会删除它,因为它可能会向下推动你的应用程序...
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Run Code Online (Sandbox Code Playgroud)
希望它有效......
| 归档时间: |
|
| 查看次数: |
9471 次 |
| 最近记录: |