键盘上的按钮是挤压的。为什么滚动不起作用?

时间:2017-04-21 02:29:10

标签: java android scrollview nestedscrollview

我有一个带按钮的屏幕"下一步"在键盘上。我添加了滚动。如果键盘打开和空间不够,我们需要使用滚动。但是有一点空间滚动没有出现,按钮也挤压了。

http://meson.ad-l.ink/8bXzYgJQW/thumb.png

http://polariton.ad-l.ink/7XGrCsMb4/thumb.png

在清单

<activity
    android:name=".activity.register.RegisterPhoneActivity"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="stateVisible|adjustResize"
    />

activity_register_phone.xml

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        xmlns:tools="http://schemas.android.com/tools"
        android:orientation="vertical">

        <include layout="@layout/w_toolbar" />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="6dp"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:fillViewport="true"
            android:scrollbars="vertical"
            >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            >

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="top"
                    >

                    <com.devspark.robototextview.widget.RobotoTextView
                        android:id="@+id/badge"
                        android:layout_width="@dimen/size_badge"
                        android:layout_height="@dimen/size_badge"
                        android:textSize="@dimen/text.16"
                        android:background="@drawable/circle_tv"
                        android:gravity="center"
                        android:text="1"
                        app:typeface="roboto_regular"
                        />

                    <com.devspark.robototextview.widget.RobotoTextView
                        android:id="@+id/title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/margin_10"
                        android:textSize="@dimen/text.26"
                        android:text="@string/enter_your_number"
                        android:layout_centerVertical="true"
                        android:layout_toRightOf="@+id/badge"
                        app:typeface="roboto_light"
                        />

                </RelativeLayout>

                <com.devspark.robototextview.widget.RobotoTextView
                    android:id="@+id/description"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_20"
                    android:gravity="left"
                    android:textSize="@dimen/text.15"
                    android:textColor="@color/secondary_text_color"
                    android:text="@string/register_phone_description"
                    app:typeface="roboto_regular"
                    />

                <com.devspark.robototextview.widget.RobotoEditText
                    android:id="@+id/et_username_phone"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="phone"
                    android:textSize="@dimen/text.24"
                    android:layout_marginTop="@dimen/margin_22"
                    android:background="@drawable/edt_bg_selector"
                    app:typeface="roboto_regular"
                    />

                <com.devspark.robototextview.widget.RobotoTextView
                    android:id="@+id/content_info"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_6"
                    android:layout_marginLeft="@dimen/margin_15"
                    android:layout_marginRight="@dimen/margin_15"
                    android:gravity="center"
                    android:textColor="@color/url_grey_text_color"
                    android:textSize="@dimen/text.11"
                    app:typeface="roboto_regular"
                    tools:text="@string/register_phone_content_info"
                    />

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

                <com.devspark.robototextview.widget.RobotoButton
                    android:id="@+id/btn_next"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_16"
                    android:layout_gravity="bottom"
                    android:text="@string/btn_register_next_step"
                    android:textSize="@dimen/text.15"
                    android:enabled="false"
                    style="@style/ButtonStyle"
                    app:typeface="roboto_medium"
                    />

            </FrameLayout>

            </LinearLayout>
    </ScrollView>
    </LinearLayout>

1 个答案:

答案 0 :(得分:0)

删除adjustResize

然后在ScrollView wrap_content中创建LinearLayout高度,然后它就不会挤压。