机器人制造布局滚动时,软键盘打开,但不是移入它向上 [英] android making layout scrollable when soft keyboard open, but not shifting it upwards

查看:134
本文介绍了机器人制造布局滚动时,软键盘打开,但不是移入它向上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的屏幕,一键隐藏在键盘后面。

This is my screen, with one button hidden behind the keyboard.

我想正是这样,但滚动的。 -

键盘一键隐藏在

无论何时,键盘被打开了,我想让它看起来一样的图像。但是,相反,使之滚动的,使得用户可以滚动以查看屏幕(包括按钮)的底部部分,即使当键盘打开

Whenever, the keyboard gets opened, I want to make look it the same as in image. But, instead to make it scrollable, so that the user can scroll to view the bottom part of the screen (including button), even when the keyboard is open.

我想 -

android:windowSoftInputMode="adjustResize"

不过,这种转移的底部向上,当键盘被打开。

but, this shifts the bottom part upwards, whenever keyboard is opened.

在此图像 -

我不想这样 - (移的创建帐户按钮向上,当键盘打开)

I don't want this - (shifting of Create Account button upwards, when keypad is opened)

输入图像的描述在这里

创建帐户按钮必须滚动后可见。

CREATE ACCOUNT button must be visible after scrolling.

下面是布局 -

<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>

请帮我解决这个问题了。

Please help me to fix this up.

推荐答案

我想你的code和我也有同样的问题<一href="http://stackoverflow.com/questions/20115416/issue-in-login-scrollview-parentbottom-elements-also-pop-up-with-softkeyboard?noredirect=1#comment52118411_20115416">Here

I tried your code and also I have the same issue Here

在这里,我做了一些修正在code和值分别为codeS为假(字符串,颜色等)... code段是:

Here I make some correction in your code and values were codes as dummy(strings, colors ect)... Code Snippet is:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical|center_horizontal"
        android:orientation="vertical"
        android:padding="10dp" >

        <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="HAI"
                android:inputType="textEmailAddress"
                android:singleLine="true" />

            <EditText
                android:id="@+id/et_pswd"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="HH"
                android:password="true"
                android:singleLine="true" />

            <Button
                android:id="@+id/btn_sign_in"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:background="#5465"
                android:text="sigin"
                android:textColor="@android:color/white" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:gravity="center_horizontal"
                android:text="ORR"
                android:textColor="@android:color/black" />

            <Button
                android:id="@+id/btn_take_a_peek"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:background="#ff8f43"
                android:text="sfse"
                android:textColor="@android:color/white" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="15dp"
                android:gravity="center_horizontal"
                android:text="Forgot"
                android:textColor="#ec0974" />
        </LinearLayout>
    </LinearLayout>

    <Button
        android:id="@+id/btn_create_account"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#ffd250"
        android:text="Create Accounr"
        android:textColor="@android:color/white" />
</RelativeLayout>
 </ScrollView>

另外设置以下参数为您的活动中,你的清单

Also set the below parameter to your activity in you Manifest

安卓windowSoftInputMode =adjustPan

android:windowSoftInputMode="adjustPan"

**编辑在视图外层是一个滚动视图内的相对布局和我所管理的创建帐户按钮父底部。

**Edited as in view outer layer is Relative layout inside a scrollview and i managed the Create Account button as parent bottom.

请尝试在一个真实的设备。

Please try it in a real device.

试试这个,给你的反馈! 快乐编码。

Try this and give your feedback !! Happy Coding..

这篇关于机器人制造布局滚动时,软键盘打开,但不是移入它向上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆