Android Scrollview的键盘弹出窗口没有向上移动

时间:2015-05-12 20:11:19

标签: android scrollview android-manifest

我有一个注册表格的视图。当键盘弹出字段没有向上移动时。任何人都可以帮我吗? 看看我的代码。:

activity_reserv.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.deeshonline.restaurant.activities.ActivityReserv">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/rl_reserv">


        <include
            android:id="@+id/app_bar_reserv"
            layout="@layout/app_bar" />
    </RelativeLayout>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/rl_reserv">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:scrollbars="vertical"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:paddingBottom="@dimen/size_byte"
            android:paddingLeft="@dimen/size_word"
            android:paddingRight="@dimen/size_word"
            android:paddingTop="@dimen/size_byte">

            <ImageView
                android:id="@+id/img_reserv"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="@drawable/restaurant_logo"
                android:layout_centerHorizontal="true"
                android:layout_gravity="center"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/error_text_reservv"
                android:layout_below="@id/img_reserv"
                android:text=""
                android:gravity="center"
                android:textColor="@android:color/holo_red_dark"
                />

            <EditText
                android:id="@+id/text_name_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:paddingTop="10dp"
                android:hint="Name"
                android:inputType="none"
                android:layout_below="@id/error_text_reservv"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:textSize="20sp" />

            <EditText
                android:id="@+id/text_datum_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="Datum"
                android:inputType="none"
                android:textSize="20sp"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:layout_below="@id/text_name_reserv" />

            <EditText
                android:id="@+id/text_tellnr_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="Tel. Nr."
                android:inputType="number"
                android:textSize="20sp"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:layout_below="@id/text_datum_reserv" />

            <EditText
                android:id="@+id/text_reservnr_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="Personenzahl."
                android:inputType="none"
                android:textSize="20sp"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:layout_below="@id/text_tellnr_reserv" />

            <EditText
                android:id="@+id/text_zeit_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="Zeit"
                android:inputType="none"
                android:textSize="20sp"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:layout_below="@id/text_reservnr_reserv" />

            <EditText
                android:id="@+id/text_email_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="eMail"
                android:inputType="textEmailAddress"
                android:textSize="20sp"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:layout_below="@id/text_zeit_reserv" />
            <EditText
                android:id="@+id/text_note_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:minLines="3"
                android:lines="3"
                android:hint="Note"
                android:inputType="textMultiLine"
                android:gravity="top|left"
                android:textSize="20sp"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:layout_below="@id/text_email_reserv" />


            <Button
                android:id="@+id/button_reserv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/text_note_reserv"
                android:layout_marginTop="20dp"
                android:text="Reservieren"
                android:imeOptions="actionSend|flagNoEnterAction"
                android:background="@color/colorPrimary" />
        </LinearLayout>

    </ScrollView>


</RelativeLayout>

和AndroidManiffest.xml

<activity
            android:name=".activities.ActivityReserv"
            android:windowSoftInputMode="stateVisible|adjustResize"
            android:label="@string/title_activity_activity_reserv"
            android:parentActivityName=".activities.ActivityMain">
</activity>

我一直在寻找一些小时但没找到。如果有人能帮助我,我将非常感激。

谢谢

1 个答案:

答案 0 :(得分:1)

您是否尝试过使用“adjustPan”?然后键盘将永远不会遮挡当前具有焦点的editText。 here