当 android 软输入使你的 et 向上推时,我怎样才能使 et 下方的视图可见?
when android soft input make your et push up , how can I to make the view visible below et?
我有一个编辑文本和一个位于布局中编辑文本下方的按钮。
布局xml可能喜欢这样:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="110dp"
android:ems="10" >
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginTop="91dp"
android:text="Button" />
</RelativeLayout>
androidmanifast 中布局的 activity 是:
android:name="com....activity.CaptureActivity"
android:windowSoftInputMode="adjustPan"
所以,问题是:
当我单击或将焦点放在 edittext 上时,软输入会自动向上推,它只是 blocked/covered 我的按钮,我想让按钮可见。当输入出现时,如何使按钮位于软输入键盘的右侧。
有人可以给我一些建议吗?谢谢。
尝试这个来维护它
android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
将您的 EditText 和 Button 包裹在 ScrollView 中,如下所示
<ScrollView>
<LinearLayout android:orientation="vertical">
<EditText/>
<Button/>
</LinearLayout>
</ScrollView>
我有一个编辑文本和一个位于布局中编辑文本下方的按钮。
布局xml可能喜欢这样:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="110dp"
android:ems="10" >
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginTop="91dp"
android:text="Button" />
</RelativeLayout>
androidmanifast 中布局的 activity 是:
android:name="com....activity.CaptureActivity"
android:windowSoftInputMode="adjustPan"
所以,问题是:
当我单击或将焦点放在 edittext 上时,软输入会自动向上推,它只是 blocked/covered 我的按钮,我想让按钮可见。当输入出现时,如何使按钮位于软输入键盘的右侧。
有人可以给我一些建议吗?谢谢。
尝试这个来维护它
android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
将您的 EditText 和 Button 包裹在 ScrollView 中,如下所示
<ScrollView>
<LinearLayout android:orientation="vertical">
<EditText/>
<Button/>
</LinearLayout>
</ScrollView>