Hi I have put all my UI elements inside a relative layout and then put the relative layout in the scrollview to achieve screen scrolling. But the layout is not scrolling in landscape mode.What am I missing here. any idea?
Thanks, P
Update: The view is not scrolling in potrait mode as well. I added some extra UI elements and the view is not scrolling in this mode either. I am using Nexus 6P phone to test it.
Here is the xml
<ScrollView 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="layout.LoginFragment"
android:fillViewport="true"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="92dp"
android:layout_height="92dp"
android:id="@+id/imageView"
android:layout_marginLeft="37dp"
android:layout_marginStart="37dp"
android:src="@mipmap/ic_logo"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="41dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/login_hello"
android:id="@+id/login_tv1"
android:fontFamily="Roboto"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20dp"
android:layout_alignTop="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:layout_toEndOf="@+id/imageView"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/login_text"
android:id="@+id/login_tv2"
android:fontFamily="Roboto"
android:textColor="#000000"
android:textSize="16dp"
android:layout_marginTop="25dp"
android:layout_alignBottom="@+id/imageView"
android:layout_alignLeft="@+id/login_tv1"
android:layout_alignTop="@+id/login_tv1" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/username_et"
android:fontFamily="Roboto"
android:layout_centerVertical="true"
android:hint="@string/login_username"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textColor="#000000"
android:layout_alignLeft="@+id/imageView"
android:layout_alignStart="@+id/imageView"
android:textColorHint="#000000"
android:textSize="18dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:width="50dp"
android:ems="10"
android:id="@+id/password_et"
android:layout_below="@+id/username_et"
android:layout_alignLeft="@+id/username_et"
android:layout_alignStart="@+id/username_et"
android:layout_marginTop="33dp"
android:layout_alignRight="@+id/username_et"
android:layout_alignEnd="@+id/username_et"
android:password="true"
android:hint="@string/login_password"
android:fontFamily="Roboto"
android:textColorHint="#000000"
android:textSize="18dp" />
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rememberme_switch"
android:layout_below="@+id/password_et"
android:layout_alignLeft="@+id/password_et"
android:layout_alignStart="@+id/password_et"
android:layout_marginTop="53dp"
android:layout_alignRight="@+id/password_et"
android:layout_alignEnd="@+id/password_et"
android:hint="@string/remember_me"
android:textOff="@string/off"
android:textOn="@string/on"
android:textSize="18dp"
android:clickable="true"
android:checked="false"
android:showText="true"
android:enabled="true"
android:focusable="true"
android:trackTint="#000000"
android:textColorLink="#000000"
android:textColorHint="#000000" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help"
android:id="@+id/help_button"
android:background="@android:color/transparent"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_below="@+id/rememberme_switch"
android:layout_alignStart="@+id/rememberme_switch"
android:layout_marginTop="34dp"
android:textSize="18dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/login"
android:id="@+id/login_button"
android:layout_marginEnd="32dp"
android:background="@android:color/transparent"
style="?android:attr/borderlessButtonStyle"
android:layout_alignTop="@+id/help_button"
android:layout_alignEnd="@+id/rememberme_switch"
android:textSize="18dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/error_tv"
android:textColor="#f92626"
android:fontFamily="Roboto"
android:textSize="16dp"
android:layout_below="@+id/password_et"
android:layout_alignStart="@+id/password_et"
android:layout_alignEnd="@+id/login_button" />
</RelativeLayout>
</ScrollView>`