1

Wenn ich meinen Bildschirm ins Querformat drehen, ein DialogFragment dieses Layout mit den beiden Schaltflächen am unteren Rand wird abgeschnitten:Buttons immer in Landschaft Rotation (Android XML) abgeschnitten

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:padding="4dp"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Alias"/> 

    <EditText 
     android:id="@+id/edittext_alias" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:inputType="textCapWords" 
     android:ems="10" 
     android:layout_marginLeft="4dp" 
     android:maxLength="30" 
     android:imeOptions="actionDone"/> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Interests"/> 

    <EditText 
     android:id="@+id/edittext_interests" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:inputType="text" 
     android:ems="10" 
     android:layout_marginLeft="4dp" 
     android:maxLength="10" 
     android:imeOptions="actionDone"/> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Bio"/> 

    <EditText 
     android:id="@+id/edittext_bio" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:inputType="textCapSentences" 
     android:ems="10" 
     android:layout_marginLeft="4dp" 
     android:maxLines="2" 
     android:gravity="top" 
     android:imeOptions="actionDone" 
     android:requiresFadingEdge="vertical" 
     android:fadingEdgeLength="20dp" 
     android:scrollbars="vertical" 
     android:fadeScrollbars="false"/> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <Button 
      android:id="@+id/button_cancel" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:text="Cancel" 
      android:layout_weight="1"/> 

     <Button 
      android:id="@+id/button_confirm" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:text="OK" 
      android:layout_gravity="center_horizontal" 
      android:layout_weight="1"/> 
    </LinearLayout> 

</LinearLayout> 

Bin ich etwas falsch machen oder etwas offensichtliches vermissen? Wie kann ich es zwingen alles anzuzeigen?

+0

können Sie das Layout XML zeigen, wo die 'Fragment' enthalten? Möglicherweise müssen Sie ein dediziertes Layout für die Querformatausrichtung erstellen. Sie legen dann eine solche Layoutdatei in das 'res/Layout-Land'. – ishmaelMakitla

+0

Es ist ein DialogFragment, also schwebt es selbst über dem Bildschirm. Dieses Layout wird bereits in 'res/layout-land' implementiert. – user6419910

Antwort

1

Ich denke, der Fall ist Ihr Bildschirm ist einfach nicht groß genug, um den gesamten Inhalt zu zeigen. Android fügt die Bildlauffunktion nicht hinzu, wenn der Inhalt größer als der Bildschirm ist. Wenn dies der Fall ist, wickeln Sie alle Ihre Ansichten in eine ScrollView, so dass die Schaltflächen nach dem Bildlauf sichtbar sein könnten. Wie folgt aus:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:padding="4dp"> 

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

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <!-- Putt all your view here --> 

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

Auch Sie können setzen Scroll als Ihre Eltern Ansicht

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <!-- Putt all your view here --> 

     </LinearLayout> 
    </ScrollView>