滚动旋转视图 android

Scroll rotated view in android

我正在编写 Android 应用程序。

我有一个 activity,其中包含一些 EditText、一个微调器和一些按钮。按钮位于布局的底部。 当我旋转模拟器时,底部的按钮在横向时旋转离开屏幕底部,因为它没有那么高。是否可以在横向时使视图滚动,以便我可以到达按钮。 (我使用的是相对布局)。

感谢您的帮助。

是的,这是可能的......使用滚动视图,一切都会如你所愿 试试这个 .. 我想它会有所帮助

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/layout_back"
    tools:context="eddine.charef.mechalikh.swipedemo.inscription" >

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/scrollView3"
        android:layout_above="@+id/textView2"  >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:orientation="vertical"
            android:weightSum="1"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/infosGenerales"
                android:id="@+id/textView5"
                android:background="#0061C2"
                android:textColor="#ffffffff" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPersonName"
                android:ems="10"
                android:id="@+id/editNom"
                android:layout_weight="0.15"
                android:hint="@string/nom"
                android:gravity="center"
                android:background="@drawable/rounded_corner_2"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="5dp"
                android:selectAllOnFocus="false"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPersonName"
                android:ems="10"
                android:id="@+id/editPrenom"
                android:layout_weight="0.15"
                android:hint="@string/prenom"
                android:gravity="center"
                android:background="@drawable/rounded_corner_2"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:selectAllOnFocus="false"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textEmailAddress"
                android:ems="10"
                android:id="@+id/editEmail"
                android:layout_weight="0.15"
                android:hint="@string/email"
                android:gravity="center"
                android:background="@drawable/rounded_corner_2"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:selectAllOnFocus="false"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:ems="10"
                android:id="@+id/editPswrd"
                android:layout_weight="0.15"
                android:hint="@string/mdp"
                android:gravity="center"
                android:background="@drawable/rounded_corner_2"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:selectAllOnFocus="false"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:ems="10"
                android:id="@+id/editCnfrmPswrd"
                android:layout_weight="0.15"
                android:hint="@string/retapezMdp"
                android:gravity="center"
                android:background="@drawable/rounded_corner_2"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:selectAllOnFocus="false"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <Spinner
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/spinner4" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/infosSurMedecin"
                android:id="@+id/textView4"
                android:background="#0061C2"
                android:textColor="#ffffffff"
                android:visibility="gone" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="date"
                android:ems="10"
                android:id="@+id/editNum"
                android:layout_gravity="center_horizontal"
                android:hint="@string/numero"
                android:visibility="gone"
                android:gravity="center"
                android:background="@drawable/rounded_corner_2"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="5dp"
                android:selectAllOnFocus="false"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <Spinner
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/spinner5"
                android:visibility="gone" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/lieuxTravail"
                android:id="@+id/textView3"
                android:background="#0061C2"
                android:textColor="#ffffffff"
                android:visibility="gone" />


            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:id="@+id/editAdresse"
                android:hint="@string/adresse"
                android:visibility="gone"
                android:gravity="center"
                android:background="@drawable/rounded_corner_2"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="5dp"
                android:selectAllOnFocus="false"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/position"
                android:id="@+id/tvPosition"
                android:layout_gravity="center_horizontal"
                android:visibility="gone" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/choisirPosition"
                android:id="@+id/btnChoisirPos"
                android:onClick="btnChoisirPosClick"
                android:nestedScrollingEnabled="false"
                android:visibility="gone" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/inscription"
                android:id="@+id/btnInscri"
                android:layout_alignRight="@+id/editNom"
                android:layout_alignEnd="@+id/editNom"
                android:onClick="btnInscriClick"
                android:nestedScrollingEnabled="false"
                android:layout_alignParentBottom="true"
                android:textColor="#ffffffff"
                android:background="@drawable/btn_back" />

        </LinearLayout>
    </ScrollView>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/avezVousUnCompte"
        android:id="@+id/textView2"
        android:onClick="textViewConnexClick"
        android:clickable="true"
        android:textColor="#ff0061c2"
        android:layout_weight="0.15"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:gravity="center_horizontal" />



</RelativeLayout>