Nar*_*ngh 16 android android-keypad scrollable android-layout
这是我的屏幕,键盘后面隐藏着一个按钮.
我想要这样,但可滚动. -
每当键盘打开时,我想让它看起来和图像一样.但是,要使其可滚动,以便用户可以滚动以查看屏幕的底部(包括按钮),即使键盘处于打开状态.
我试过了 -
android:windowSoftInputMode="adjustResize"
Run Code Online (Sandbox Code Playgroud)
但是,只要键盘打开,这就会将底部向上移动.
如在这张图片中 -
我不想要这个 - (Create Account当键盘打开时按钮向上移动)
滚动后必须显示CREATE ACCOUNT按钮.
这是布局 -
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/root_layout"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10"
>
<LinearLayout android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="9"
android:orientation="vertical"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<EditText
android:id="@+id/et_username_or_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/et_hint_username_or_email"
android:inputType="textEmailAddress"
android:singleLine="true"
/>
<EditText
android:id="@+id/et_pswd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/et_hint_password"
android:password="true"
android:singleLine="true"
/>
<Button
android:id="@+id/btn_sign_in"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btn_sign_in"
android:background="@color/lighter_orange"
android:textColor="@android:color/white"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/or"
android:gravity="center_horizontal"
android:textColor="@android:color/black"/>
<Button
android:id="@+id/btn_take_a_peek"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btn_take_a_peek"
android:textColor="@android:color/white"
android:background="@color/button_gray"/>
<TextView
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/forgot_password"
android:gravity="center_horizontal"
android:textColor="@color/text_gray"/>
</LinearLayout>
</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:id="@+id/btn_create_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/btn_create_account"
android:background="@color/button_very_light_orange"
android:textColor="@android:color/white"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.
在清单文件中添加此输入模式.
android:windowSoftInputMode="stateHidden|adjustResize"
Run Code Online (Sandbox Code Playgroud)
我有同样的问题并解决了。
将此添加到您班级<activity>的AndroidManifest中的标签内的班级中:
android:windowSoftInputMode="stateHidden|adjustResize">
Run Code Online (Sandbox Code Playgroud)
要么:
<activity
android:name="com.app.app.RegisterScreen"
android:parentActivityName="com.app.app.LogInScreen"
android:windowSoftInputMode="stateHidden|adjustPan">
</activity>
Run Code Online (Sandbox Code Playgroud)
例:
<activity
android:name="com.app.yourapp.LogInScreen"
android:windowSoftInputMode="stateHidden|adjustPan">
</activity>
Run Code Online (Sandbox Code Playgroud)
这对我有用。
成为你观点的根源
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
...
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15219 次 |
| 最近记录: |