2016-06-11 5 views
0

Das ist mein XML-Code ist:Scroll in RelativeLayout: Boden Layout blockiert EditText in Scroll

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:fitsSystemWindows="true" 
    android:layout_height="match_parent"> 


    <ScrollView 
     android:layout_width="match_parent" 
     android:isScrollContainer="false" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="16dp" 
      android:background="#FFF" 
      android:elevation="2dp" 
      android:paddingBottom="32dp"> 

      <View 
       android:id="@+id/view7" 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:layout_centerInParent="true" /> 

      <android.support.design.widget.TextInputLayout android:textColorHint="@color/textColorAbu" 
       android:id="@+id/til_event_create_sport_date" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:layout_below="@+id/s_sport" 
       android:layout_alignLeft="@+id/til_event_create_sport_starttime" 
       android:layout_alignStart="@+id/til_event_create_sport_starttime"> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
        android:layout_alignParentTop="true" 
        android:hint="Date" 
        android:imeActionId="@+id/et_search" 
        android:imeActionLabel="@string/register.first_name" 
        android:imeOptions="actionUnspecified" 
        android:inputType="date" 
        android:singleLine="true" 
        android:id="@+id/et_sport_date" /> 

      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout android:textColorHint="@color/textColorAbu" 
       android:id="@+id/til_event_create_sport_starttime" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignEnd="@+id/view7" 
       android:layout_alignRight="@+id/view7" 
       android:layout_below="@+id/til_event_create_sport_date" 
       android:layout_marginBottom="4dp" 
       android:layout_marginLeft="4dp" 
       android:layout_marginTop="4dp" 
       android:layout_weight="1"> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
        android:layout_alignParentTop="true" 
        android:hint="Start Time" 
        android:imeActionId="@+id/et_search" 
        android:imeActionLabel="@string/register.first_name" 
        android:imeOptions="actionUnspecified" 
        android:singleLine="true" 
        android:id="@+id/et_" 
        android:inputType="time" /> 

      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout android:textColorHint="@color/textColorAbu" 
       android:id="@+id/til_event_create_sport_endtime" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentEnd="true" 
       android:layout_alignParentRight="true" 
       android:layout_alignTop="@+id/til_event_create_sport_starttime" 
       android:layout_toEndOf="@+id/til_event_create_sport_starttime" 
       android:layout_toRightOf="@+id/til_event_create_sport_starttime" 
       android:layout_weight="1"> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
        android:layout_alignParentTop="true" 
        android:hint="End Time" 
        android:imeActionId="@+id/et_search" 
        android:imeActionLabel="@string/register.first_name" 
        android:imeOptions="actionUnspecified" 
        android:inputType="time" 
        android:singleLine="true" /> 

      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout android:textColorHint="@color/textColorAbu" 
       android:id="@+id/til_event_create_sport_location" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/til_event_create_sport_starttime" 
       android:layout_margin="4dp"> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
        android:layout_alignParentTop="true" 
        android:hint="Location" 
        android:imeActionId="@+id/et_search" 
        android:imeActionLabel="@string/register.first_name" 
        android:imeOptions="actionUnspecified" 
        android:inputType="date" 
        android:singleLine="true" 
        android:id="@+id/et_location" /> 
      </android.support.design.widget.TextInputLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:layout_below="@+id/til_event_create_sport_location" 
       android:gravity="center_vertical" 
       android:orientation="horizontal" 
       android:paddingLeft="8dp" 
       android:paddingRight="8dp" 
       android:id="@+id/linearLayout4"> 

       <TextView 
        android:id="@+id/textView43" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignLeft="@+id/til_event_create_sport_location" 
        android:layout_alignStart="@+id/til_event_create_sport_location" 
        android:layout_below="@+id/til_event_create_sport_location" 
        android:layout_weight="1" 
        android:text="Event Type" /> 

       <Spinner 
        android:id="@+id/s_eventtype" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignTop="@+id/textView43" 
        android:layout_toEndOf="@+id/til_event_create_sport_starttime" 
        android:layout_toRightOf="@+id/til_event_create_sport_starttime" 
        android:layout_weight="1" 
        android:entries="@array/eventtype_arrays" 
        android:spinnerMode="dropdown" /> 
      </LinearLayout> 

      <android.support.design.widget.TextInputLayout android:textColorHint="@color/textColorAbu" 
       android:id="@+id/til_event_create_sport_additionalinfo" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/linearLayout4" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true"> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
        android:layout_alignParentTop="true" 
        android:hint="Additional Information" 
        android:imeActionId="@+id/et_search" 
        android:imeActionLabel="@string/register.first_name" 
        android:imeOptions="actionUnspecified" 
        android:inputType="textMultiLine" 
        android:singleLine="false" 
        android:id="@+id/et_additional_info" /> 
      </android.support.design.widget.TextInputLayout> 

      <Spinner 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/s_sport" 
       android:spinnerMode="dialog" 
       android:layout_below="@+id/textView10" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:entries="@array/sport_arrays" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Sport Type" 
       android:id="@+id/textView10" 
       android:layout_alignParentTop="true" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:textSize="13sp" 
       android:textColor="@color/colorPrimary" 
       android:layout_marginLeft="8dp" /> 

     </RelativeLayout> 
    </ScrollView> 

    <LinearLayout 
     android:id="@+id/linearLayout3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center|bottom" 
     android:background="@color/colorPrimary" 
     android:orientation="horizontal" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true"> 

     <LinearLayout 
      android:id="@+id/ll_cancel" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="?android:attr/selectableItemBackground" 
      android:clickable="true" 
      android:gravity="center" 
      android:orientation="horizontal" 
      android:padding="8dp"> 

      <ImageView 
       android:id="@+id/imageView4" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@android:drawable/ic_menu_close_clear_cancel" 
       android:src="@drawable/abc_ic_clear_mtrl_alpha" /> 

      <TextView 
       android:id="@+id/textView8" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:paddingLeft="8dp" 
       android:text="Cancel" 
       android:textColor="@color/white" 
       android:textSize="18sp" /> 

     </LinearLayout> 

     <View 
      android:layout_width="1dp" 
      android:layout_height="fill_parent" 
      android:layout_marginBottom="8dp" 
      android:layout_marginTop="8dp" 
      android:background="@color/white" /> 

     <LinearLayout 
      android:id="@+id/ll_create" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="?android:attr/selectableItemBackground" 
      android:clickable="true" 
      android:gravity="center" 
      android:orientation="horizontal" 
      android:padding="8dp"> 

      <ImageView 
       android:id="@+id/imageView3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@android:drawable/ic_menu_close_clear_cancel" 
       android:src="@drawable/abc_ic_clear_mtrl_alpha" /> 

      <TextView 
       android:id="@+id/textView6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:paddingLeft="8dp" 
       android:text="Create" 
       android:textColor="@color/white" 
       android:textSize="18sp" /> 
     </LinearLayout> 
    </LinearLayout> 

</RelativeLayout> 

Das (normal) Layout wie folgt aussieht: http://s33.postimg.org/60h0lwg67/Screenshot_2016_06_11_16_51_42_com_example_erdea.png

Aber wenn ich auf der EditText konzentrieren, Die Sicht blockiert sie: http://s33.postimg.org/61e3cubq7/Screenshot_2016_06_11_16_46_50_com_example_erdea.png

Wie entferne ich die Ansicht? (Das erwartete Ergebnis ist, dass die "Buttons" dort nicht angezeigt werden und den Editiertext blockieren, wenn er fokussiert ist). Vielen Dank!

Antwort

0

Versuchen Sie, die Bildlaufansicht des android Entfernung: layout_alignParentBottom = "true" und ersetzen Sie es mit android: layout_alignParentTop = "true"

+0

immer noch kein Glück ... – user

+0

Ich habe es auf einem Nexus 5 AVD mit API Level 23 getestet und es funktioniert gut, was Deveice/Emulator haben Sie verwendet? –

+0

Ich benutzte Xiaomi MIUI 7 API 23, aber es funktionierte mit Xperia M API 18. Danke! – user

0

Sie versuchen android:windowSoftInputMode="adjustPan" in your activity` Element in Android manifext XML kann. Auf diese Weise wird das Fenster nicht vergrößert, wenn die Tastatur auftaucht.