I developed an android application in which the scroll-view is not scrolling.. I am posting the code here please check and if found any error please help.. Here I used ScrollView as root and then LinearLayout... but this is not scrolling up.. I Updated the xml still not working
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
android:weightSum="1">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
EDITED AS BELOW, but still not working well, the scrollbar stop at half of label name:"label_h_total"
<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"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
The Warning
A scrolling widget such as a ScrollView should not contain any nested scrolling widgets since this has various usability issues
This should be works. There was a problem with the LinearLayout, the height was wrap_content. The first child of scrollview needs to have only match_parent for both width and height and that's it.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true"
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"
android:background="#color/colorPrimary">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
android:weightSum="1">
xmlns:tools="http://schemas.android.com/tools" put this in scrollview and edit child of scrollview.
Related
I want to put a scrollView between two Layout and put all 3 layout in 1 constraintLayout as below :
<ConstraintLayout>
<LinearLayout> // Title
<ScrollView>
<RelativeLayout> // Buttons
<ConstraintLayout>
this in my Layout XML code :
<android.support.constraint.ConstraintLayout
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:id="#+id/registerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
app:layout_constraintRight_toRightOf="parent"
tools:context="momtaz.moshaver_yar.StudentFragment_Register">
<LinearLayout
android:id="#+id/titleLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#color/colorPrimary"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/registerStudentTitleTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="ثبت نام دانش آموز"
android:textColor="#color/colorPrimaryText"
android:textSize="20sp" />
</LinearLayout>
<ScrollView
android:id="#+id/registerStudentScroll"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#android:color/white"
android:fillViewport="true"
android:orientation="vertical"
android:scrollbars="vertical"
app:layout_constraintBottom_toTopOf="#+id/registerStudentBtn"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/titleLayout">
<LinearLayout
android:id="#+id/regstscrollayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="rtl"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerNameLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStNameEdit"
android:text="نام و نام خانوادگی :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStNameEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="right|center_vertical"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerBirthDateLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="تاریخ تولد :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<TextView
android:id="#+id/registerBirthDateTxt"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:textColor="#android:color/black"
android:textDirection="rtl"
android:textSize="14sp"
tools:text="10/08/1369" />
<Button
android:id="#+id/registerBirthDateBtn"
android:layout_width="28dp"
android:layout_height="28dp"
android:background="#drawable/datebtnselector" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerGenderLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="جنسیت :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="#+id/registerGenderBoy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="#drawable/radiobtnselector"
android:paddingLeft="5dp"
android:text=" پسر"
android:textColor="#android:color/black"
android:textSize="16sp" />
<RadioButton
android:id="#+id/registerGenderGirl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="#drawable/radiobtnselector"
android:text=" دختر"
android:textColor="#android:color/black"
android:textSize="16sp" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerMCodeLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="کد ملی :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStMCodeEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerMobileLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#+id/regStPhoneEdit"
android:text="شماره تماس :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStMobileEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="phone"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerPhoneLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="شماره تماس منزل :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStPhoneEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="phone"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStGradeLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="پایه تحصیلی :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStGradeEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="phone"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TableRow
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#android:color/darker_gray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerAdviserLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStAdviserEdit"
android:text="کد مشاور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<AutoCompleteTextView
android:id="#+id/regStAdviserEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerAdviserNameLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStNameEdit"
android:text="نام مشاور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<TextView
android:id="#+id/regStAdviserNameTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TableRow
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#android:color/darker_gray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStUNameLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStUNameEdit"
android:text="نام کاربری :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStUNameEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStUPassLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStUPassEdit"
android:text="رمز عبور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStUPassEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStUPass2Label"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStUPass2Edit"
android:text="تکرار رمز عبور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStUPass2Edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/registerStudentBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<Button
android:id="#+id/regStPostBtn"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="5dp"
android:background="#drawable/btnselector"
android:text="ثبت"
android:textColor="#android:color/white"
android:textSize="16sp" />
<ImageView
android:id="#+id/regStProgressImg"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_toLeftOf="#+id/regStPostBtn"
android:background="#drawable/loading_animate" />
<Button
android:id="#+id/regStCancelBtn"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:background="#drawable/btnselector"
android:text="انصراف"
android:textColor="#android:color/white"
android:textSize="16sp" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
I have created this connections of constraintLayout :
Top of TitleLayout to Top of Parent
Top of ScrollView to Bottom of TitleLayout
Bottom of ScrollView to Top of ButtonLayout
Bottom of ButtonLayout to Bottom of Parent
Right and Left of All Layouts to Right and Left of Parent
There is no problem is Design-View but when I test it in GenyMotion emulator, the ButtonLayout doesn't show, it seems that the Height of ScrollView is larger than the space between bottom of TitleView and top of ButtonLayout, I can't find out whats going wrong !
I have tested NestedScrollView instead of ScrollView or RelativeLayout instead of ConstraintLayout but the problem not solved
I suggest you put the LinearLayout, ScrollView and the RelativeLayout in a vertical chain to keep them properly constrained to each other and to prevent them from overlapping. In order to create the chain you need to add a couple additional constraints:
bottom of TitleLayout to top of ScrollView
top of ButtonLayout to bottom of ScrollView
Please note that I only added two additional constraints to create a chain and did not change anything else or did not fix any other small problems with the XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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:id="#+id/registerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
app:layout_constraintRight_toRightOf="parent"
tools:context="momtaz.moshaver_yar.StudentFragment_Register">
<LinearLayout
android:id="#+id/titleLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#color/colorPrimary"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#id/registerStudentScroll"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/registerStudentTitleTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="ثبت نام دانش آموز"
android:textColor="#color/colorPrimaryText"
android:textSize="20sp" />
</LinearLayout>
<ScrollView
android:id="#+id/registerStudentScroll"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#android:color/white"
android:fillViewport="true"
android:orientation="vertical"
android:scrollbars="vertical"
app:layout_constraintBottom_toTopOf="#+id/registerStudentBtn"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/titleLayout">
<LinearLayout
android:id="#+id/regstscrollayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="rtl"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerNameLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStNameEdit"
android:text="نام و نام خانوادگی :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStNameEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="right|center_vertical"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerBirthDateLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="تاریخ تولد :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<TextView
android:id="#+id/registerBirthDateTxt"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:textColor="#android:color/black"
android:textDirection="rtl"
android:textSize="14sp"
tools:text="10/08/1369" />
<Button
android:id="#+id/registerBirthDateBtn"
android:layout_width="28dp"
android:layout_height="28dp"
android:background="#drawable/datebtnselector" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerGenderLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="جنسیت :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="#+id/registerGenderBoy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="#drawable/radiobtnselector"
android:paddingLeft="5dp"
android:text=" پسر"
android:textColor="#android:color/black"
android:textSize="16sp" />
<RadioButton
android:id="#+id/registerGenderGirl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="#drawable/radiobtnselector"
android:text=" دختر"
android:textColor="#android:color/black"
android:textSize="16sp" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerMCodeLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="کد ملی :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStMCodeEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerMobileLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#+id/regStPhoneEdit"
android:text="شماره تماس :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStMobileEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="phone"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerPhoneLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="شماره تماس منزل :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStPhoneEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="phone"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStGradeLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:text="پایه تحصیلی :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStGradeEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="phone"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TableRow
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#android:color/darker_gray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerAdviserLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStAdviserEdit"
android:text="کد مشاور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<AutoCompleteTextView
android:id="#+id/regStAdviserEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerAdviserNameLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStNameEdit"
android:text="نام مشاور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<TextView
android:id="#+id/regStAdviserNameTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TableRow
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#android:color/darker_gray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStUNameLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStUNameEdit"
android:text="نام کاربری :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStUNameEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStUPassLabel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStUPassEdit"
android:text="رمز عبور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStUPassEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/registerStUPass2Label"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="left"
android:labelFor="#id/regStUPass2Edit"
android:text="تکرار رمز عبور :"
android:textColor="#android:color/black"
android:textSize="15sp" />
<EditText
android:id="#+id/regStUPass2Edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/editselector"
android:gravity="left|center_vertical"
android:inputType="number"
android:padding="3dp"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/registerStudentBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#id/registerStudentScroll"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<Button
android:id="#+id/regStPostBtn"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="5dp"
android:background="#drawable/btnselector"
android:text="ثبت"
android:textColor="#android:color/white"
android:textSize="16sp" />
<ImageView
android:id="#+id/regStProgressImg"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_toLeftOf="#+id/regStPostBtn"
android:background="#drawable/loading_animate" />
<Button
android:id="#+id/regStCancelBtn"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:background="#drawable/btnselector"
android:text="انصراف"
android:textColor="#android:color/white"
android:textSize="16sp" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
I am trying to use horizontal scrollview inside a scroll view. My parent scroll isn't scrolling smoothly. Although my child scroll is scrolling smoothly, I want to achieve smooth scrolling of parent scroll. I have tried every method, I have in my mind setting HardwareAccelerated to false worked but it removed elevation from my views.
Main Activity
<?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="#ECEFF1"
android:clipToPadding="false">
<RelativeLayout
android:layout_width="250dp"
android:layout_height="90dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="75dp"
android:layout_marginTop="100dp"
android:background="#drawable/round_corners"
android:clipToPadding="false"
android:elevation="5dp"
android:translationZ="5dp"
tools:layout_editor_absoluteX="42dp"
tools:layout_editor_absoluteY="121dp">
<ImageView
android:id="#+id/enquiry"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/visa"
android:layout_marginEnd="35dp"
app:srcCompat="#drawable/phone" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/textView2"
android:layout_marginEnd="20dp"
android:text="Enquiry"
android:textColor="#color/navigationBarColor"
android:textSize="15sp" />
<ImageView
android:id="#+id/visa"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignTop="#+id/holidays"
android:layout_centerHorizontal="true"
app:srcCompat="#drawable/globe" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView3"
android:layout_centerHorizontal="true"
android:text="Visa"
android:textColor="#android:color/background_dark"
android:textSize="15sp" />
<ImageView
android:id="#+id/holidays"
android:layout_width="25dp"
android:layout_height="32dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="35dp"
android:layout_marginTop="18dp"
app:srcCompat="#drawable/plane" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="14dp"
android:layout_marginStart="20dp"
android:text="Holidays"
android:textColor="#android:color/background_dark" />
</RelativeLayout>
<include
android:id="#+id/toolbar"
layout="#layout/app_bar" />
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="false"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#color/colorPrimary"
android:fontFamily="serif"
android:text="Call"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
<ScrollView
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="200dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="50dp"
android:text="Pilgrimage"
android:textColor="#android:color/background_dark"
android:textSize="25sp"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:id="#+id/pilg"
class="com.example.admin.myapplication.Pilgrimage"
android:layout_width="320dp"
android:layout_height="240dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/round_corners"
android:elevation="5dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/hu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="155dp"
android:fontFamily="serif"
android:text="Hajj And Umrah"
android:textColor="#color/navigationBarColor"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="190dp"
android:text="Ramzan Umrah"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="210dp"
android:layout_marginTop="190dp"
android:text="29 Days/30 Nights"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="205dp"
android:text="Starts From Rs.65,000/-"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Holiday Packages"
android:textColor="#color/navigationBarColor"
android:textSize="25sp"
android:textStyle="bold" />
<HorizontalScrollView
android:id="#+id/child"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/international"
class="com.example.admin.myapplication.International"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/ll"
android:elevation="5dp"
android:padding="-25dp">
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp"
android:fontFamily="serif"
android:text="International"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dom1"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/rajasthan"
android:elevation="5dp">
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:fontFamily="serif"
android:text="Domestic"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Social"
android:textColor="#color/navigationBarColor"
android:textSize="25sp" />
<LinearLayout
android:layout_width="335dp"
android:layout_height="50dp"
android:layout_marginBottom="100dp"
android:layout_marginLeft="25dp"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</ScrollView>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:fontFamily="serif"
android:text="Al Shariq Enterprises"
android:textColor="#color/textColorPrimary"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
Try this NestedScrollView like this :-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="200dp">
<android.support.v4.widget.NestedScrollView
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="50dp"
android:text="Pilgrimage"
android:textColor="#android:color/background_dark"
android:textSize="25sp"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:id="#+id/pilg"
class="com.example.admin.myapplication.Pilgrimage"
android:layout_width="320dp"
android:layout_height="240dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/round_corners"
android:elevation="5dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/hu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="155dp"
android:fontFamily="serif"
android:text="Hajj And Umrah"
android:textColor="#color/navigationBarColor"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="190dp"
android:text="Ramzan Umrah"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="210dp"
android:layout_marginTop="190dp"
android:text="29 Days/30 Nights"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="205dp"
android:text="Starts From Rs.65,000/-"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Holiday Packages"
android:textColor="#color/navigationBarColor"
android:textSize="25sp"
android:textStyle="bold" />
<HorizontalScrollView
android:id="#+id/child"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/international"
class="com.example.admin.myapplication.International"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/ll"
android:elevation="5dp"
android:padding="-25dp">
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp"
android:fontFamily="serif"
android:text="International"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dom1"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/rajasthan"
android:elevation="5dp">
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:fontFamily="serif"
android:text="Domestic"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Social"
android:textColor="#color/navigationBarColor"
android:textSize="25sp" />
<LinearLayout
android:layout_width="335dp"
android:layout_height="50dp"
android:layout_marginBottom="100dp"
android:layout_marginLeft="25dp"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
For basic details you can check this link.
I think that this happens because both of your ScrollViews reacts to scrolling so it seems to you that it lags, but it actually don't, its just vertical ScrollView interrupting horizontal ScrollView.
It is not recommended using ScrollView inside another ScrollView. Instead use NestedScrollView as in this answer.
I developed an Tabs android application in which the scroll-view is not scrolling.. I am posting the code here please check and if found any error please help.. Here I used ScrollView as root and then LinearLayout... but this is not scrolling at the end (stop at half of label name:"label_h_total")
<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"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
XML tabs:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="#dimen/custom_tab_layout_height"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
I have a parent layout in which I want to add a child layout onClick of another layout. The layout I want to add it's visibility is gone right now. After clicking on NextDestination layout it shows the another layout which is LinearAddedDestination. I want to add this layout when the user clicks on NextDestination layout till 14 times after 14 times the NextDestination layout should not be visible.
How can I achieve this??
GoBoxActivity Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1.00"
android:background="#android:color/white"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="DESTINATION"
android:id="#+id/textView14"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#drawable/shape"
android:gravity="right"
android:layout_gravity="center|right"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="100dp"
android:id="#+id/LinearRemove"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_clear_black_18dp"
android:layout_marginLeft="05dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="REMOVE"
android:id="#+id/textView47"
android:layout_gravity="center"
android:layout_marginLeft="05dp"
android:textSize="14sp"
android:layout_marginRight="15dp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="08dp"
android:id="#+id/imageView14"
android:background="#drawable/line2"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView10"
android:layout_marginStart="20dp"
android:background="#drawable/ic_place_black_48dp"
android:layout_marginTop="05dp"
android:layout_gravity="center" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Text_to"
android:drawableEnd="#drawable/ic_chevron_right_black_24dp"
android:layout_marginEnd="10dp"
android:text="#string/Loc"
android:layout_gravity="center"
android:layout_marginTop="05dp"
android:textAppearance="#android:style/TextAppearance.Medium"
android:cursorVisible="false"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Street/Building/Place"
android:layout_marginStart="48dp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView17"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_to_details"
android:layout_marginEnd="10dp"
android:hint="#string/LocationDetails"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewHouseDetailsTo"
android:layout_marginStart="48dp"
android:hint="#string/HouseDetails" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:id="#+id/LinearLayoutAdditionalContactTo">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView18"
android:layout_marginStart="20dp"
android:background="#drawable/ic_person_black_48dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/contactDetailsTo"
android:layout_marginEnd="10dp"
android:text="#string/additionalContact"
android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableEnd="#drawable/ic_expand_more_black_24dp"
android:layout_marginTop="08dp"
android:layout_marginStart="05dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginEnd="50dp"
android:layout_gravity="center"
android:visibility="gone"
android:id="#+id/LinearLayoutTo"
android:layout_marginTop="20dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTex"
android:layout_weight="1"
android:hint="Name"
android:layout_gravity="center"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTe"
android:layout_weight="1"
android:hint="Phone"
android:layout_gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/or"
android:id="#+id/textViewInputIfSender"
android:layout_gravity="center"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="220dp"
android:layout_height="40dp"
android:background="#drawable/shape"
android:layout_gravity="center_horizontal">
<ImageButton
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageButton1"
android:background="#drawable/phone2"
android:layout_gravity="center"
android:layout_marginStart="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/addFromContacts"
android:id="#+id/textView35"
android:layout_gravity="center"
android:layout_marginStart="20dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewInputReceiver"
android:layout_marginLeft="48dp"
android:hint="#string/contact1"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusable="true"
android:focusableInTouchMode="true">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView12"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_from_details"
android:layout_marginEnd="10dp"
android:hint="Instruction"
android:layout_gravity="center"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1.00"
android:background="#android:color/white"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:id="#+id/LinearAddedDestination"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="DESTINATION"
android:id="#+id/textView14"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#drawable/shape"
android:gravity="right"
android:layout_gravity="center|right"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="80dp"
android:id="#+id/LinearRemove">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_clear_black_18dp"
android:layout_marginLeft="05dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="REMOVE"
android:id="#+id/textView47"
android:layout_gravity="center"
android:layout_marginLeft="05dp"
android:textSize="14sp"
android:layout_marginRight="15dp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="08dp"
android:id="#+id/imageView14"
android:background="#drawable/line2"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView10"
android:layout_marginStart="20dp"
android:background="#drawable/ic_place_black_48dp"
android:layout_marginTop="05dp"
android:layout_gravity="center" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Text_to"
android:drawableEnd="#drawable/ic_chevron_right_black_24dp"
android:layout_marginEnd="10dp"
android:text="#string/Loc"
android:layout_gravity="center"
android:layout_marginTop="05dp"
android:textAppearance="#android:style/TextAppearance.Medium"
android:cursorVisible="false"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Street/Building/Place"
android:layout_marginStart="48dp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView17"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_to_details"
android:layout_marginEnd="10dp"
android:hint="#string/LocationDetails"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewHouseDetailsTo"
android:layout_marginStart="48dp"
android:hint="#string/HouseDetails" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:id="#+id/LinearLayoutAdditionalContactTo">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView18"
android:layout_marginStart="20dp"
android:background="#drawable/ic_person_black_48dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/contactDetailsTo"
android:layout_marginEnd="10dp"
android:text="#string/additionalContact"
android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableEnd="#drawable/ic_expand_more_black_24dp"
android:layout_marginTop="08dp"
android:layout_marginStart="05dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginEnd="50dp"
android:layout_gravity="center"
android:visibility="gone"
android:id="#+id/LinearLayoutTo"
android:layout_marginTop="20dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTex"
android:layout_weight="1"
android:hint="Name"
android:layout_gravity="center"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTe"
android:layout_weight="1"
android:hint="Phone"
android:layout_gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/or"
android:id="#+id/textViewInputIfSender"
android:layout_gravity="center"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="220dp"
android:layout_height="40dp"
android:background="#drawable/shape"
android:layout_gravity="center_horizontal">
<ImageButton
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageButton1"
android:background="#drawable/phone2"
android:layout_gravity="center"
android:layout_marginStart="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/addFromContacts"
android:id="#+id/textView35"
android:layout_gravity="center"
android:layout_marginStart="20dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/textViewInputReceiver"
android:layout_marginLeft="48dp"
android:hint="#string/contact1"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusable="true"
android:focusableInTouchMode="true">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageView12"
android:layout_marginStart="20dp"
android:background="#drawable/ic_description_black_48dp"
android:layout_marginTop="10dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="#+id/editText_from_details"
android:layout_marginEnd="10dp"
android:hint="Instruction"
android:layout_gravity="center"
android:layout_marginLeft="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="#drawable/shape"
android:layout_gravity="right"
android:layout_marginEnd="15dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:id="#+id/LinearNextDestination">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_add_black_18dp"
android:layout_marginLeft="05dp"
android:layout_marginTop="05dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="NEXT DESTINATION"
android:id="#+id/textView47"
android:layout_gravity="center"
android:layout_marginLeft="05dp"
android:textSize="14sp"
android:layout_marginRight="15dp" />
</LinearLayout>
</LinearLayout>
You are having many layout as the child layout for the main layout. But the better way to achieve your goal is to add fragment.
Using the fragment you can easily change the layouts view. Look at these links. Adding fragment will solve your problem.
http://developer.android.com/training/basics/fragments/creating.html
http://examples.javacodegeeks.com/android/core/app/fragment/android-fragments-example/
http://www.vogella.com/tutorials/AndroidFragments/article.html
http://www.learn2crack.com/2014/05/android-working-with-fragments.html
Using the fragment you can divide the space in the layout and add multiple fragments inside that.
I have a three section relative layout for a login page.
The first section at the top of the page is 1 Imageview and 2 Textviews.
The second section is 6 RelativeLayouts containing 1 ImageView to the left and 1 TextView to the right.
The third section is a Button
The first four icons are ok on any device. The 5th and 6th are both getting resized or not showing up.
I would like to see all 6 but if 1 can't fit dont add it. How can I do this in a proper way.
Thanks - P.S Code is below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/newd_login_overlay"
android:orientation="vertical" >
<LinearLayout android:id="#+id/linLoginText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/login_logo_white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_one"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_two"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linLoginFeature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/btnLoginCreate"
android:layout_below="#+id/linLoginText"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginSecurity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_security"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginSecurity"
android:layout_toEndOf="#+id/imgLoginSecurity"
android:layout_centerVertical="true"
android:text="#string/newd_login_security"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginAntivirus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_antivirus"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginAntivirus"
android:layout_toEndOf="#+id/imgLoginAntivirus"
android:layout_centerVertical="true"
android:text="#string/newd_login_antivirus"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_phone_tracker"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginTracker"
android:layout_toEndOf="#+id/imgLoginTracker"
android:layout_centerVertical="true"
android:text="#string/newd_login_booster"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBackup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_backup"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBackup"
android:layout_toEndOf="#+id/imgLoginBackup"
android:layout_centerVertical="true"
android:text="#string/newd_login_backup"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_privacy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginPrivacy"
android:layout_toEndOf="#+id/imgLoginPrivacy"
android:layout_centerVertical="true"
android:text="#string/newd_login_privacy"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBooster"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_signal_booster"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBooster"
android:layout_toEndOf="#+id/imgLoginBooster"
android:layout_centerVertical="true"
android:text="#string/newd_login_tracker"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="#+id/btnLoginCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_alignParentBottom="true"
android:background="#drawable/newd_login_btn"
android:gravity="center"
android:text="#string/newd_login_btn_text"
android:textColor="#android:color/black" />
</RelativeLayout>
Use android:layout_weight
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/newd_login_overlay"
android:orientation="vertical" >
<LinearLayout android:id="#+id/linLoginText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/login_logo_white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_one"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_two"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linLoginFeature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="6"
android:layout_above="#+id/btnLoginCreate"
android:layout_below="#+id/linLoginText"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="vertical" >
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginSecurity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_security"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginSecurity"
android:layout_toEndOf="#+id/imgLoginSecurity"
android:layout_centerVertical="true"
android:text="#string/newd_login_security"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginAntivirus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_antivirus"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginAntivirus"
android:layout_toEndOf="#+id/imgLoginAntivirus"
android:layout_centerVertical="true"
android:text="#string/newd_login_antivirus"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_phone_tracker"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginTracker"
android:layout_toEndOf="#+id/imgLoginTracker"
android:layout_centerVertical="true"
android:text="#string/newd_login_booster"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBackup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_backup"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBackup"
android:layout_toEndOf="#+id/imgLoginBackup"
android:layout_centerVertical="true"
android:text="#string/newd_login_backup"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_privacy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginPrivacy"
android:layout_toEndOf="#+id/imgLoginPrivacy"
android:layout_centerVertical="true"
android:text="#string/newd_login_privacy"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBooster"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_signal_booster"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBooster"
android:layout_toEndOf="#+id/imgLoginBooster"
android:layout_centerVertical="true"
android:text="#string/newd_login_tracker"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="#+id/btnLoginCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_alignParentBottom="true"
android:background="#drawable/newd_login_btn"
android:gravity="center"
android:text="#string/newd_login_btn_text"
android:textColor="#android:color/black" />
</RelativeLayout>