2017-01-09 3 views
0

This is the output i am getting i want it to look normal and with a scroll view wrapping this content Dies ist meine Layout-Datei für die login.xml, aber wenn ich das im Portrait-Modus sehe sieht das gut für mich, aber wenn Ich mache das ist Porträt es gibt überschüssige RolleIch möchte in meinem Layout scrollen, aber wenn ich das mache, gibt es mir überschüssige Scroll

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_height="wrap_content" 
      android:layout_width="match_parent" 
      android:fillViewport="true"> 

<!-- Relative layout defined for the view and components --> 
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/login_activity_layout" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/bgimagelogin" 
      tools:context="com.example.a129346.applicationpoc.activities.LoginActivity"> 

      <TextView 
       android:id="@+id/app_name_tv" 
       android:text="@string/lexus_string" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="5" 
       android:textColor="@color/colorPeace" 
       android:layout_marginLeft="@dimen/aligned_text_side_marginleft" 
       android:layout_marginTop="@dimen/aligned_text_side_marginTop" 
       android:textSize="@dimen/size_text" /> 

      <TextView 
       android:id="@+id/join_now_tv" 
       android:text="@string/new_user" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="24dp" 
       android:textColor="@color/colorPeace" 
       android:layout_below="@+id/login_bt" 
       android:layout_alignEnd="@+id/password_et" /> 

      <EditText 
       android:id="@+id/username_et" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:inputType="textPersonName" 
       android:hint="@string/person_name" 
       android:ems="10" 
       android:textColor="@color/colorPeace" 
       android:drawableLeft="@drawable/person_mdpi" 
       android:layout_below="@+id/app_name_tv" 
       android:layout_alignStart="@+id/app_name_tv" 
       android:layout_marginTop="12dp" /> 

      <EditText 
       android:id="@+id/password_et" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:inputType="textPassword" 
       android:ems="10" 
       android:drawableLeft="@drawable/lock_mdpi" 
       android:hint="@string/password_string" 
       android:textColor="@color/colorPeace" 
       android:layout_below="@+id/username_et" 
       android:layout_alignStart="@+id/username_et" 
       android:layout_marginTop="17dp" /> 

      <CheckBox 
       android:id="@+id/remember_me_cb" 
       android:text="@string/checkbox_me" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="@color/colorPeace" 
       android:layout_alignBaseline="@+id/forgotText2" 
       android:layout_alignBottom="@+id/forgotText2" 
       android:layout_alignParentEnd="true" /> 
     <!--text for the forget password--> 
      <TextView 
       android:id="@+id/forgotText2" 
       android:text="@string/text_password_forgot" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="31dp" 
       android:textColor="@color/colorPeace" 
       android:layout_below="@+id/password_et" 
       android:layout_toStartOf="@+id/join_now_tv" /> 
     <!--Button for the login--> 
      <Button 
       android:id="@+id/login_bt" 
       android:text="@string/button_string" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="12dp" 
       android:background="@color/colorButton" 
       android:layout_below="@+id/remember_me_cb" 
       android:layout_alignEnd="@+id/join_now_tv" 
       android:layout_alignStart="@+id/password_et" /> 
     <!--Image view for icon--> 
      <ImageView 
       android:id="@+id/app_icon_iv" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/ic_header_icon" 
       android:layout_marginLeft="@dimen/aligned_icon_side_marginleft" 
       android:layout_marginBottom="48dp" 
       android:layout_above="@+id/username_et" 
       android:layout_alignEnd="@+id/forgotText2" /> 



     </RelativeLayout> 
     </ScrollView> 

Dies ist das Gesamtlayout für die Anmeldeseite.

Ich möchte in meinem Layout scrollen, aber wenn ich diesen Code mache, ist es mehr als genug scrollen und scrollen alle Seite ich möchte nur meine Komponenten scrollen oder passen Sie den Bildschirm.

+0

entfernen android: fillViewport = "true" –

+0

fügen Sie unter Eigenschaft zu scrollview android hinzu: fitSystemWindows = "true" – Noorul

+0

Ahamed @ diese Eigenschaft muss ich in Scroll-Ansicht Tag hinzufügen? –

Antwort

0
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_height="match_parent" 
      android:layout_width="match_parent" 
      android:fillViewport="true"> 

<!-- Relative layout defined for the view and components --> 
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/login_activity_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/bgimagelogin" 
      tools:context="com.example.a129346.applicationpoc.activities.LoginActivity"> 

      <TextView 
       android:id="@+id/app_name_tv" 
       android:text="@string/lexus_string" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="5" 
       android:textColor="@color/colorPeace" 
       android:layout_marginLeft="@dimen/aligned_text_side_marginleft" 
       android:layout_marginTop="@dimen/aligned_text_side_marginTop" 
       android:textSize="@dimen/size_text" /> 

      <TextView 
       android:id="@+id/join_now_tv" 
       android:text="@string/new_user" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="24dp" 
       android:textColor="@color/colorPeace" 
       android:layout_below="@+id/login_bt" 
       android:layout_alignEnd="@+id/password_et" /> 

      <EditText 
       android:id="@+id/username_et" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:inputType="textPersonName" 
       android:hint="@string/person_name" 
       android:ems="10" 
       android:textColor="@color/colorPeace" 
       android:drawableLeft="@drawable/person_mdpi" 
       android:layout_below="@+id/app_name_tv" 
       android:layout_alignStart="@+id/app_name_tv" 
       android:layout_marginTop="12dp" /> 

      <EditText 
       android:id="@+id/password_et" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:inputType="textPassword" 
       android:ems="10" 
       android:drawableLeft="@drawable/lock_mdpi" 
       android:hint="@string/password_string" 
       android:textColor="@color/colorPeace" 
       android:layout_below="@+id/username_et" 
       android:layout_alignStart="@+id/username_et" 
       android:layout_marginTop="17dp" /> 

      <CheckBox 
       android:id="@+id/remember_me_cb" 
       android:text="@string/checkbox_me" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="@color/colorPeace" 
       android:layout_alignBaseline="@+id/forgotText2" 
       android:layout_alignBottom="@+id/forgotText2" 
       android:layout_alignParentEnd="true" /> 
     <!--text for the forget password--> 
      <TextView 
       android:id="@+id/forgotText2" 
       android:text="@string/text_password_forgot" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="31dp" 
       android:textColor="@color/colorPeace" 
       android:layout_below="@+id/password_et" 
       android:layout_toStartOf="@+id/join_now_tv" /> 
     <!--Button for the login--> 
      <Button 
       android:id="@+id/login_bt" 
       android:text="@string/button_string" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="12dp" 
       android:background="@color/colorButton" 
       android:layout_below="@+id/remember_me_cb" 
       android:layout_alignEnd="@+id/join_now_tv" 
       android:layout_alignStart="@+id/password_et" /> 
     <!--Image view for icon--> 
      <ImageView 
       android:id="@+id/app_icon_iv" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/ic_header_icon" 
       android:layout_marginLeft="@dimen/aligned_icon_side_marginleft" 
       android:layout_marginBottom="48dp" 
       android:layout_above="@+id/username_et" 
       android:layout_alignEnd="@+id/forgotText2" /> 



     </RelativeLayout> 
     </ScrollView> 

Ersetzen Sie Ihren Code mit diesem.

+0

überhaupt nicht funktioniert noch die Bildlaufansicht ist das Layout –

+0

teilen Sie Ihre Screenshots, was genau Sie wollen, ist nicht klar ... –

+0

Ich teilte das Bild mit dem bearbeiteten Post –

Verwandte Themen