In my login page I have two LinearLayouts. The second Linear-layout I want to set at center of it's Parent Relative layout and another Linear layout I want to be set top|left of it's parent Relative- layout.
How can I achieve this?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/yellow">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="top"
android:layout_alignParentLeft="true"
android:orientation="vertical">
<TextView
android:id="#+id/user_name_text_view_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="#string/language_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/redcolor" />
<Spinner
android:id="#+id/spinnerList"
style="#style/spinner_style"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:src="#drawable/ic_serba_logo_red" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/textmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:orientation="vertical">
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/username_title"
android:inputType="textEmailAddress"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/password_title"
android:inputType="textPassword"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:weightSum="2">
<Button
android:id="#+id/registerButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_register_title"
android:textColor="#android:color/white" />
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_login__title"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
You just need to change 2 things :
android:fillViewport="true" //for scrollView
and for your RelativeLayout height should be match_parent
android:layout_height="match_parent"
use android:layout_centerInParent="true" for LinearLayout when its parent is Relative layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/yellow">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="top"
android:layout_alignParentLeft="true"
android:orientation="vertical">
<TextView
android:id="#+id/user_name_text_view_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="#string/language_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/redcolor" />
<Spinner
android:id="#+id/spinnerList"
style="#style/spinner_style"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:src="#drawable/ic_serba_logo_red" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/textmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:orientation="vertical">
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/username_title"
android:inputType="textEmailAddress"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/password_title"
android:inputType="textPassword"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:weightSum="2">
<Button
android:id="#+id/registerButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_register_title"
android:textColor="#android:color/white" />
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_login__title"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I have Change your code Just try it. i think its work well
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/background_light">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="top"
android:layout_alignParentLeft="true"
android:orientation="vertical">
<TextView
android:id="#+id/user_name_text_view_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark" />
<Spinner>
android:id="#+id/spinnerList"
style="#"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="#mipmap/ic_launcher" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/textmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:orientation="vertical">
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#android:color/holo_blue_light"
android:ems="10"
android:hint="username"
android:inputType="textEmailAddress"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#android:color/holo_blue_light"
android:ems="10"
android:hint="password"
android:inputType="textPassword"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:weightSum="2">
<Button
android:id="#+id/registerButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:background="#color/BlueColor"
android:text="register"
android:textColor="#android:color/white" />
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:layout_weight="1"
android:background="#1FFBBD"
android:text="Login"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
Related
I'm having a hard time aligning my button to the bottom of "login_password"
I've tried endOf and it didn't work at all and align at bottom of parent and none of it seemed to work. I've tried using margin to move it to the bottom but it just breaks the username textbox. Are there any solutions for the problem I'm experiencing?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/myBlue"
android:orientation="vertical"
android:gravity="center"
tools:context="com.vice.jake.ric.fads.view.activites.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/logov3_4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_toEndOf="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
Use Linear Layout(orientation- vertical) with weight when working for Login screen so that it fits fine to all the screen sizes
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/blue"
android:gravity="center"
android:orientation="vertical"
android:weightSum="10">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignParentTop="true"
android:layout_weight="2"
android:src="#drawable/logov3_4" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></View>
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/luxx_edittext"
android:drawableLeft="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/luxx_edittext"
android:drawableLeft="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></View>
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#color/holo_red_light"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"></View>
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:padding="20dp"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor" />
</LinearLayout>
Try this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorAccent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="275dp"
android:src="#drawable/places_ic_search" />
<LinearLayout
android:id="#+id/relativelayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="#color/colorAccent"
android:drawablePadding="15dp"
android:drawableStart="#drawable/places_ic_clear"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:background="#color/colorPrimary"
android:drawablePadding="15dp"
android:drawableStart="#drawable/places_ic_clear"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="#id/login_password"
android:background="#color/colorAccent"
android:text="REGISTER"
android:textColor="#ff00" />
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:text="Don't have an Account? Create one!"
android:textColor="#ff00" />
</RelativeLayout>
OUTPUT
You can use LinearLayout instead of RelativeLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/logov3_4" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_toEndOf="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
You should use layout_below to align button below the password field..I have reformatted your code to add that
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightBlue"
android:orientation="vertical"
android:gravity="center"
tools:context="com.vice.jake.ric.fads.view.activites.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/ic_about" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_below="#id/login_password"
android:layout_marginTop="5dp"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
Try this :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/main_relative"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/container_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/second_container_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/card_linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_toEndOf="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
<TextView
android:layout_width="20dp"
android:layout_height="20dp" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:id="#+id/pay_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
Try below XML Code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/myBlue"
android:orientation="vertical"
android:gravity="center"
tools:context="com.vice.jake.ric.fads.view.activites.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/logov3_4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_below="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
You will get below output.
You are aligning the button to the endOf which means right side of the edittext. You have to align below the edittext layout as below
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
So u should be able to see the button below the login_password
You can use android:layout_below instead of android:layout_toEndOf.
Positions the top edge of this view below the given anchor view ID.
Accommodates top margin of this view and bottom margin of anchor view.
android:layout_below="#id/"
Finally
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_below="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
Try this..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f6faf7"
android:gravity="center"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativelayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="275dp"
android:layout_toStartOf="#id/relativelayout1"
android:adjustViewBounds="true">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativelayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/login_password"
android:text="REGISTER" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:text="Don't have an Account? Create one!" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
And your output like this..
My XML is too slow, and I already found other's example but it didn't help mine.
See My XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:windowSoftInputMode="adjustResize">
<!--Preview Card-->
<android.support.v7.widget.CardView
android:id="#+id/preview"
android:layout_width="380dp"
android:layout_height="213.75dp"
android:background="#drawable/ic_ending"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
<ImageView
android:id="#+id/preview_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/bg_1" />
<ImageView
android:id="#+id/preview_black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.3"
android:src="#000000" />
<TextView
android:id="#+id/preview_text1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="#string/input_text"
android:textColor="#FFFFFF"
android:textAlignment="center"
android:textSize="20sp" />
</android.support.v7.widget.CardView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--Empty Card-->
<android.support.v7.widget.CardView
android:id="#+id/preview_empty"
android:layout_width="380dp"
android:layout_height="213.75dp"
android:background="#drawable/ic_ending"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
</android.support.v7.widget.CardView>
<!--Menu_1 Card-->
<android.support.v7.widget.CardView
android:id="#+id/menu_1"
android:layout_width="380dp"
android:layout_height="wrap_content"
android:background="#drawable/ic_ending"
android:layout_below="#+id/preview_empty"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Text Font-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/text_font"
android:textStyle="bold"
android:textSize="16sp"/>
<Spinner
android:id="#+id/dropdown_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/colortext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_color_text"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"/>
<ImageView
android:id="#+id/boldtext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_bold"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground" />
<ImageView
android:id="#+id/italictext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_italic"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"/>
</LinearLayout>
</LinearLayout>
<!--Text Size-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/text_size"
android:textStyle="bold"
android:textSize="16sp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="#dimen/usual_margin">
<SeekBar
android:id="#+id/textsize_sb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="#+id/textsize_edit"
android:layout_centerInParent="true"
android:progress="20"
android:max="99"/>
<EditText
android:id="#+id/textsize_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:ems="2"
android:maxLength="2"
android:text="20"
android:textAlignment="center"
android:inputType="number" />
</RelativeLayout>
</LinearLayout>
<!--Input Text-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/input_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/input_text"
android:textStyle="bold"
android:textSize="16sp"/>
<EditText
android:id="#+id/inputtext_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:ems="10"
android:inputType="text|textMultiLine|textCapSentences"
android:text="#string/input_text" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<!--Menu_2 Card-->
<android.support.v7.widget.CardView
android:id="#+id/menu_2"
android:layout_width="380dp"
android:layout_height="wrap_content"
android:background="#drawable/ic_ending"
android:layout_below="#+id/menu_1"
android:layout_marginTop="20dp"
android:layout_marginBottom= "80dp"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Outer_Glow-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_glow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/outer_glow"
android:textStyle="bold"
android:shadowRadius="20"
android:shadowColor="#color/colorWhite"
android:shadowDx="0"
android:shadowDy="0"
android:textSize="16sp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="#dimen/usual_margin">
<SeekBar
android:id="#+id/glow_sb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="#+id/glow_edit"
android:layout_centerInParent="true"
android:progress="20"
android:max="99"/>
<EditText
android:id="#+id/glow_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:ems="2"
android:maxLength="2"
android:text="20"
android:textAlignment="center"
android:inputType="number" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
<!--Preview Guideline -->
<ImageView
android:layout_width="match_parent"
android:layout_height="253.75dp"
android:src="#FAFAFA"/>
<!--Save Button-->
<android.support.design.widget.FloatingActionButton
android:id="#+id/saveexp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"
android:clickable="true"
android:src="#drawable/ic_save"
android:tint="#FFFFFF"
app:fabSize="normal"/>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
That's it, and even it's hard to scroll it.
I already check java code, but it's not slow, but when I check xml code in temp app without java code, it is hard to scroll.
Is this structure bad?
Or why is it too slow...
What can I do? Thanks for your answering.
I have this form and when the soft keyboard is open, the screen does not resize and dont make scroll on it.
I really want to know why. Why my view does not scroll? Why does not resize?
This is my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
>
<ScrollView
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#android:color/transparent"
android:visibility="invisible"
app:navigationIcon="#drawable/ic_left_arrow"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<ImageView
android:id="#+id/imageView9"
android:layout_width="180dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:src="#drawable/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView9"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/imageView9"
android:layout_below="#+id/imageView9"
android:layout_marginLeft="15dp"
android:paddingBottom="6dp"
android:text="OFERTAR OU \nSIMULAR LANCE"
android:textColor="#eb262a"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/livre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Livre" />
<RadioButton
android:id="#+id/fixo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Fixo" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Percentual do lance">
<EditText
android:id="#+id/percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView12"
android:layout_toStartOf="#+id/textView12"
android:ems="10"
android:inputType="numberDecimal"
android:nextFocusDown="#+id/value"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textView12"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="%"
android:textColor="#000"
android:textSize="16dp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Valor do lance">
<EditText
android:id="#+id/value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:hint="Número do Protocolo">
<EditText
android:id="#+id/protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="10">
<Button
android:id="#+id/limpar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Limpar"
android:textColor="#ffffff"
android:visibility="visible" />
<Button
android:id="#+id/simular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Simular"
android:textColor="#ffffff"
android:visibility="visible" />
<Button
android:id="#+id/registrar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Registrar"
android:textColor="#ffffff"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:text="Lance Fixo é definido em 30%"
android:textAlignment="center"
android:textColor="#000"
android:textSize="16sp"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
</LinearLayout>
I already tried set match_parent to scrollview.
And I have this in my manifest android:windowSoftInputMode="stateAlwaysHidden|adjustResize".
If you are using "FULLSCREEN" theme for your application or activity then the "RESIZE" functionality will not work, you should use "NoTitleBar" theme without "FULLSCREEN".
It will work 100%.
And you should use "RelativeLayout" in place of parent layout(main linearlayout).
I found the problem. I'm using <item name="android:windowFullscreen">true</item>
and when the fullscreen flags are actived, the resize dont work.
If you want to resize the activity when the keyboard pops up you need to specify a line of code in manifest file inside activity tag :
android:windowSoftInputMode="adjustResize"
Refer this link for more details : https://developer.android.com/training/keyboard-input/visibility.html
You can even try to adjust screen in activity put the below code in you activity onCreate method:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Hope this should help!!
add this line to activity which you want to resize on opening soft keyboard:
android:windowSoftInputMode="adjustResize"
UPDATE POST:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#android:color/transparent"
android:visibility="invisible"
app:navigationIcon="#drawable/ic_left_arrow"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<ImageView
android:id="#+id/imageView9"
android:layout_width="180dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:src="#drawable/logo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView9"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/imageView9"
android:layout_below="#+id/imageView9"
android:layout_marginLeft="15dp"
android:paddingBottom="6dp"
android:text="OFERTAR OU \nSIMULAR LANCE"
android:textColor="#eb262a"
android:textSize="20sp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/livre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Livre"/>
<RadioButton
android:id="#+id/fixo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Fixo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Percentual do lance">
<EditText
android:id="#+id/percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView12"
android:layout_toStartOf="#+id/textView12"
android:ems="10"
android:inputType="numberDecimal"
android:nextFocusDown="#+id/value"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textView12"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="%"
android:textColor="#000"
android:textSize="16dp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Valor do lance">
<EditText
android:id="#+id/value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:hint="Número do Protocolo">
<EditText
android:id="#+id/protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="10">
<Button
android:id="#+id/limpar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Limpar"
android:textColor="#ffffff"
android:visibility="visible"/>
<Button
android:id="#+id/simular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Simular"
android:textColor="#ffffff"
android:visibility="visible"/>
<Button
android:id="#+id/registrar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Registrar"
android:textColor="#ffffff"
android:visibility="gone"/>
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:text="Lance Fixo é definido em 30%"
android:textAlignment="center"
android:textColor="#000"
android:textSize="16sp"
android:visibility="gone"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
I am getting problem to make this layout scroll it is not scrolling. I have also used the Scrollview in this. I am not able to detect why it is not working. This is a login screen with Social Login buttons at the bottom of the screen. but it is not working.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mail_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#mipmap/login_bg_img"
android:isScrollContainer="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:isScrollContainer="true">
<TextView
android:id="#+id/txt_heading"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="15dp"
android:background="#null"
android:gravity="center"
android:text="Sign In"
android:textColor="#ffffff"
android:textSize="#dimen/Login_signinText" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:src="#mipmap/login_logo_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#mipmap/login_input_bar1"
android:gravity="left|center_vertical"
android:orientation="vertical">
<EditText
android:id="#+id/et_email_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:hint="Username"
android:maxLength="20"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="#777e86"
android:textColorHint="#777e86"
android:textSize="#dimen/Login_username" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_singup_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#mipmap/login_input_bar2"
android:gravity="left|center_vertical"
android:orientation="vertical">
<EditText
android:id="#+id/et_password_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:hint="Password"
android:inputType="textPassword"
android:maxLength="15"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="#777e86"
android:textColorHint="#777e86"
android:textSize="#dimen/Login_username" />
</LinearLayout>
<TextView
android:id="#+id/txt_forget_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="5dp"
android:text="Forgot Password?"
android:textColor="#ffffff"
android:textSize="#dimen/Login_forgotpassword" />
<TextView
android:id="#+id/txt_sign_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="30dp"
android:gravity="center"
android:text="Forget Password"
android:textColor="#ffffff"
android:textSize="#dimen/Login_forgotpassword" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/login_btn"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/login_btn" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Let me in"
android:textColor="#fff"
android:textSize="18sp" />
</RelativeLayout>
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical"-->
<!--android:gravity="center"-->
<!--android:layout_marginTop="15dp"-->
<!--android:paddingBottom="10dp"-->
<!--android:layout_alignParentBottom="true">-->
<!--<TextView-->
<!--android:id="#+id/forgot_login"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:paddingBottom="8dp"-->
<!--android:paddingRight="5dp"-->
<!--android:text="Forgot Password ?"-->
<!--android:textSize="18sp"-->
<!--android:textColor="#fff"/>-->
<!--</LinearLayout>-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical"-->
<!--android:gravity="center"-->
<!--android:layout_marginTop="25dp"-->
<!--android:paddingBottom="10dp"-->
<!--android:layout_alignParentBottom="true">-->
<!--<TextView-->
<!--android:id="#+id/Sign_up"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:paddingBottom="8dp"-->
<!--android:paddingRight="5dp"-->
<!--android:text="Don't have an account? Sign Up"-->
<!--android:textSize="18sp"-->
<!--android:textColor="#fff"/>-->
<!--</LinearLayout>-->
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:id="#+id/ll_fb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#mipmap/login_facebook_btn"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="#+id/ll_google"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#mipmap/login_google_btn"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="#+id/ll_twitter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#mipmap/login_twitter_btn"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
Try to work like that
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/llbottom"
android:layout_alignParentTop="true"
>
and take id to your bottom id
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:id="#+id/llbottom"
android:weightSum="3">
close the tag at the end.</RelativeLayout>
Try adding this attribute to your scrollviewer:
android:fillViewport="true"
You use this.`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mail_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#mipmap/ic_launcher"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="120dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:isScrollContainer="true">
<TextView
android:id="#+id/txt_heading"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="15dp"
android:background="#null"
android:gravity="center"
android:text="Sign In"
android:textColor="#ffffff"
android:textSize="12sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:src="#mipmap/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#mipmap/ic_launcher"
android:gravity="left|center_vertical"
android:orientation="vertical">
<EditText
android:id="#+id/et_email_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:hint="Username"
android:maxLength="20"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="#777e86"
android:textColorHint="#777e86"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_singup_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#mipmap/ic_launcher"
android:gravity="left|center_vertical"
android:orientation="vertical">
<EditText
android:id="#+id/et_password_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:hint="Password"
android:inputType="textPassword"
android:maxLength="15"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="#777e86"
android:textColorHint="#777e86"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/txt_forget_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="5dp"
android:text="Forgot Password?"
android:textColor="#ffffff"
android:textSize="12sp" />
<TextView
android:id="#+id/txt_sign_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="30dp"
android:gravity="center"
android:text="Forget Password"
android:textColor="#ffffff"
android:textSize="12sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/login_btn"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Let me in"
android:textColor="#fff"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:id="#+id/ll_fb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#mipmap/ic_launcher"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</RelativeLayout>
I have three EditText in my layout. When i click on any of them then it shrinks my layout and the second layout is barely visible. I want that when i click on second layout ("Dear Parents"), keyboard should overlap the last edittext (teachers name) and when i click on last edittext then it should appear above keyboard.
Here are the screenshots
and here is the code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/actionbar_title_color"
android:orientation="vertical">
<include
android:id="#+id/include"
layout="#layout/toolbar" />
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp"
card_view:cardElevation="10sp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#drawable/filebinder" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="14"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:orientation="vertical">
<TextView
android:id="#+id/dateDiary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="sans-serif"
android:text="30 July"
android:textColor="#03a9f4"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#03a9f4" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/diarybookmark" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<EditText
android:id="#+id/diaryHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:ems="5"
android:fontFamily="sans-serif"
android:hint="Diary Heading"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="18sp" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/diaryTeacherName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:hint="Teacher\'s Name..."
android:textSize="16sp" />
<at.markushi.ui.CircleButton
android:id="#+id/addDiaryEntry"
android:layout_width="74dip"
android:layout_height="74dip"
android:layout_gravity="right"
android:src="#drawable/ic_action_tick"
app:cb_color="#color/actionbar_title_color"
app:cb_pressedRingWidth="8dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/diaryContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/addDiaryEntry"
android:layout_alignLeft="#+id/scrollView"
android:layout_alignStart="#+id/scrollView"
android:layout_alignTop="#+id/scrollView"
android:fontFamily="sans-serif"
android:gravity="top"
android:hint="Enter Diary Note...\n\n\n\n"
android:text="Dear Parents,"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
and here is my manifest
<activity
android:name=".DiaryEntry.DiaryEntryTeacherActivity"
android:label="DiaryEntry"
android:windowSoftInputMode="adjustResize"
android:theme="#style/AppTheme.NoActionBar"></activity>
You need to use ScrollView as;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/actionbar_title_color"
android:orientation="vertical">
<include
android:id="#+id/include"
layout="#layout/toolbar" />
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp"
card_view:cardElevation="10sp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#drawable/filebinder" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="14"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:orientation="vertical">
<TextView
android:id="#+id/dateDiary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="sans-serif"
android:text="30 July"
android:textColor="#03a9f4"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#03a9f4" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/diarybookmark" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<EditText
android:id="#+id/diaryHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:ems="5"
android:fontFamily="sans-serif"
android:hint="Diary Heading"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="18sp" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/diaryTeacherName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:hint="Teacher\'s Name..."
android:textSize="16sp" />
<at.markushi.ui.CircleButton
android:id="#+id/addDiaryEntry"
android:layout_width="74dip"
android:layout_height="74dip"
android:layout_gravity="right"
android:src="#drawable/ic_action_tick"
app:cb_color="#color/actionbar_title_color"
app:cb_pressedRingWidth="8dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/diaryContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/addDiaryEntry"
android:layout_alignLeft="#+id/scrollView"
android:layout_alignStart="#+id/scrollView"
android:layout_alignTop="#+id/scrollView"
android:fontFamily="sans-serif"
android:gravity="top"
android:hint="Enter Diary Note...\n\n\n\n"
android:text="Dear Parents,"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</ScrollView>
</LinearLayout>