Cancel image or button on the top of the view android - android

Hi,
I am trying to create Cancel button on top of the view like in above image.while scroll also image should be still. i have used Floating button.Cancel image is coming as normal but floating round background still coming in the background.i want to remove it.how to remove it or any other way to do it.
Here is my code :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.ProductDetailsSingleActivity">
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/cancel_image"
android:layout_alignParentTop="true"
style="?android:attr/borderlessButtonStyle"
android:background="#android:color/transparent"
app:rippleColor="#null"
app:backgroundTint="#null"
android:src="#drawable/cancel1" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/cancel_image">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imageView1"
android:layout_margin="10dp"
android:layout_width="300dp"
android:layout_height="200dp"
android:src="#drawable/con_pump5"
android:layout_centerHorizontal="true"
/>
<LinearLayout
android:id="#+id/ll_album_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_below="#id/imageView1"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingBottom="8dp"
android:paddingTop="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/ll_media_count"
android:orientation="horizontal">
<TextView
android:id="#+id/rupees"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="4dp"
android:paddingRight="4dp"
android:maxLines="1"
android:text="Rs.12,00,000"
android:textColor="#color/colorBlack"
android:textSize="14sp" />
<ImageView
android:id="#+id/album_media_label"
android:layout_width="20dp"
android:text="media"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:src="#drawable/outline_favorite_border_black_18" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="#+id/decription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:text="Silos for selling with good condi.."
android:textColor="#color/colorBlack"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/location2"/>
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:maxLines="1"
android:ellipsize="end"
android:text="Bangalore,Karnataka"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/view_line"
android:layout_width="match_parent"
android:layout_below="#+id/ll_album_info"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/des_linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_below="#+id/view_line"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description :"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#android:color/black"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/des"
android:textSize="15sp"
android:textColor="#color/colorBlack"
/>
</LinearLayout>
<View
android:id="#+id/view_line2"
android:layout_width="match_parent"
android:layout_below="#+id/des_linear"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/detail_linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_below="#+id/view_line2"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Details :"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#android:color/black"/>
</LinearLayout>
<LinearLayout
android:id="#+id/last_linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_below="#+id/detail_linear"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="#+id/text_FeeType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/company_name"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/text_name_Val"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/company_name1"
android:textSize="15sp"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="#+id/text_FeeAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/contact_person"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/text_class_Val"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/contact_person1"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="#+id/text_reg_no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/mobile_no"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/text_reg_Val"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/mobile_no1"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="#+id/text_class_teacher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="#string/landline_no"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/text_class_teacher_Val"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/landline_no"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="#+id/text_birth_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/address"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/text_birth_date_Val"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/address1"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="#+id/text_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/location"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/text_address_Val"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/location1"
android:textColor="#color/colorBlack"
android:textSize="15sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/model_of_year"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/model_of_year1"
android:textSize="15sp"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/serial_number"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/serial_number1"
android:textSize="15sp"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/new_machine_cost"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/new_machine_cost1"
android:textSize="15sp"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/expecting_cost"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/expecting_cost1"
android:textSize="15sp"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/comments"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="#string/comments1"
android:textSize="15sp"
android:textColor="#color/colorBlack" />
</LinearLayout>
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:textColor="#color/colorBlack"
android:layout_below="#+id/last_linear"
android:text="CHAT"/>
</RelativeLayout>
</ScrollView>

Do like this way: First, add the Scroll view in the parent layout with attribute align parent top as true. Then below Scrollview, you can add the cancel button also have attribute align parent top as true.

Related

layout_weight overlapping the views

I am having trouble with assigning the layout_weight to the views since it keeps overlapping with one another. I have set the weightSum = 5 and the layout_weight of each view as 0.1, 0.15, 2, 2.5, 0.125, 0.125 which in total adds up to 5 but I still can't figure out why it is overlapping.
This is my code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<View
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="#color/grey_400" />
<ImageView
android:id="#+id/imageView_id"
android:layout_width="match_parent"
android:layout_height="320dp"
android:layout_margin="10dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#color/white" />
<View
android:layout_alignParentRight="true"
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#color/grey_400"/>
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#color/white"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_weight="0.1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView"
android:layout_alignParentBottom="true"
android:layout_marginBottom="183dp"
android:layout_marginEnd="61dp"
android:text="Report"
android:textColor="#color/black"
android:textSize="25dp"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="#color/grey_400" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_weight="0.15"
android:gravity="center_vertical">
<TextView
android:id="#+id/tv_date_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Date"
android:textSize="20dp" />
<TextView
android:id="#+id/tv_time_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Time"
android:textSize="20dp" />
</RelativeLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
app:cardCornerRadius="8dp"
android:layout_marginRight="20dp"
android:layout_weight="2"
app:cardElevation="10dp">
<LinearLayout
android:orientation="vertical"
android:weightSum="5"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MR Number:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_mr_number_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="true"
android:text="P-142356"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_age_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="71"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Eye:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_eye_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RIGHT"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test type:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Supra threshold 24-2"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fixation Monitor:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"
android:id="#+id/textView" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BLIND SPOT"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
app:cardCornerRadius="8dp"
android:layout_marginRight="20dp"
android:layout_weight="2.5"
app:cardElevation="10dp">
<LinearLayout
android:orientation="vertical"
android:weightSum="5"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fixation Loss:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_fixation_loss_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 / 10"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="False Positive:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_falsePositive_points_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 / 10"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="False Negative:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_falseNegative_points_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 / 54"
android:textAllCaps="true"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Duration:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_test_duration_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="N/A"
android:textAllCaps="true"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Place:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_place_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="N/A"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.125"
android:text="NEW TEST"
android:textStyle="bold"/>
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.125"
android:text="NEW TEST"
android:textStyle="bold"/>
</LinearLayout>
The result I am getting is something like this,
But want I actually want is something like this,
You have to manage weight according to minimum requirement of size. I have set android:weightSum="7" and then distribute in 0.5, 0.5, 2.5, 2.5, 0.5, 0.5 according to text size or minimum requirement according to view.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<View
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="#color/grey_400" />
<ImageView
android:id="#+id/imageView_id"
android:layout_width="match_parent"
android:layout_height="320dp"
android:layout_margin="10dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#color/white" />
<View
android:layout_alignParentRight="true"
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#color/grey_400"/>
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#color/white"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="7">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:text="Report"
android:textColor="#color/black"
android:textSize="25dp"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="#color/grey_400" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<TextView
android:id="#+id/tv_date_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Date"
android:textSize="20dp" />
<TextView
android:id="#+id/tv_time_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Time"
android:textSize="20dp" />
</RelativeLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
app:cardCornerRadius="8dp"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_weight="2.5"
app:cardElevation="10dp">
<LinearLayout
android:orientation="vertical"
android:weightSum="5"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MR Number:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_mr_number_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="true"
android:text="P-142356"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_age_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="71"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Eye:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_eye_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RIGHT"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test type:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Supra threshold 24-2"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fixation Monitor:"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/black"
android:id="#+id/textView" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BLIND SPOT"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
app:cardCornerRadius="8dp"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_weight="2.5"
app:cardElevation="10dp">
<LinearLayout
android:orientation="vertical"
android:weightSum="5"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fixation Loss:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_fixation_loss_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 / 10"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="False Positive:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_falsePositive_points_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 / 10"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="False Negative:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_falseNegative_points_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 / 54"
android:textAllCaps="true"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Duration:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_test_duration_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="N/A"
android:textAllCaps="true"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Place:"
android:textSize="17dp"
android:textStyle="bold"
android:textColor="#color/black" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tv_place_id"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="N/A"
android:textAllCaps="true"
android:textSize="15dp"
android:textStyle="bold"
android:textColor="#color/grey_500"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"
android:text="NEW TEST"
android:layout_marginTop="5dp"
android:textStyle="bold"/>
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="0.5"
android:text="NEW TEST"
android:textStyle="bold"/>
</LinearLayout>

Align text with images with equal spacing

I need to align the images and buttons equall with the header but it's not assigning. When I check in landscape, align getting mismatch. Here is my code.
When I checked in device, it's not fitting correctly.
Below is the code and output screen (My output and actual output which needed).
I used weight but it's not fitting correctly in all devices.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="29dp"
android:layout_marginTop="16dp"
android:background="#color/colorAlabaster">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="50dp"
android:gravity="center"
android:text="Retailer" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="Hari sebelumnya" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:text="Pindahkan ke hari" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_weight="1">
<com.hutchison.h3i.newangie.customviews.CircleImageView
android:id="#+id/recycle_profile"
android:layout_width="#dimen/growth_sell_in_out_icon_size"
android:layout_height="#dimen/growth_sell_in_out_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:src="#drawable/ic_default_profile" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:orientation="vertical">
<TextView
android:id="#+id/recycle_txt_acc_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_number"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_very_small" />
<TextView
android:id="#+id/recycle_txt_acc_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_name"
android:textColor="#color/colorCyan"
android:textSize="#dimen/text_size_very_small" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="86dp"
android:layout_height="29dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginLeft="8dp"
android:background="#drawable/border_grey_curve"
android:text="Selasa"
android:textAllCaps="false"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight=".2">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/ic_arrow_right"
android:gravity="center"
android:textColor="#color/colorBlack"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="86dp"
android:layout_height="29dp"
android:background="#drawable/border_grey_curve"
android:drawablePadding="5dp"
android:drawableRight="#drawable/ic_arrow_bottom"
android:singleLine="true"
android:text="Kamis"
android:textAllCaps="false"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
My Output:
Actual output:
Here i have fixed the issue for you. But as the screen size will increase so does the size between your button and upper portion too. But your layout won't get messy. And if you want everything to remain fixed even on bigger screen sizes then you should use constraintLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="29dp"
android:layout_marginTop="16dp"
android:background="#color/colorPrimaryLight">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="50dp"
android:gravity="center"
android:text="Retailer" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="Hari sebelumnya" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:text="Pindahkan ke hari" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:weightSum="4">
<com.hutchison.h3i.newangie.customviews.CircleImageView
android:id="#+id/recycle_profile"
android:layout_width="#dimen/growth_sell_in_out_icon_size"
android:layout_height="#dimen/growth_sell_in_out_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:src="#drawable/ic_default_profile" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:id="#+id/recycle_txt_acc_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="sad234 234234"
android:textColor="#color/primary_text"
android:textSize="12sp" />
<TextView
android:id="#+id/recycle_txt_acc_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/title_activity_test"
android:textColor="#color/secondary_text"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.5">
<android.support.v7.widget.AppCompatButton
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="8dp"
android:background="#drawable/bg_spinner_nothing_selected"
android:gravity="center"
android:text="Selasa"
android:textAllCaps="false"
android:textColor="#color/primary_text" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight=".5">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/ic_add"
android:gravity="center"
android:textColor="#color/primary_text"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_weight="1.5">
<android.support.v7.widget.AppCompatButton
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#drawable/bg_spinner_nothing_selected"
android:drawableRight="#drawable/ic_edit_grey"
android:singleLine="true"
android:text="Kamis"
android:textAllCaps="false"
android:textColor="#color/primary_text"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Hope it will help you. I have replaced the colors and ic_images with mine you will have to change them too by your own.
Hope this would work. I redesign with your same xml file.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="29dp"
android:layout_marginTop="16dp"
android:background="#color/colorAlabaster">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Retailer" />
<TextView
android:id="#+id/textView9"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Hari sebelumnya" />
<TextView
android:layout_width="0dp"
android:layout_weight=".2"
android:layout_height="wrap_content"
android:gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Pindahkan ke hari" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="8dp"
android:layout_weight="1">
<LinearLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<com.hutchison.h3i.newangie.customviews.CircleImageViewx
android:id="#+id/recycle_profile"
android:layout_width="#dimen/growth_sell_in_out_icon_size"
android:layout_height="#dimen/growth_sell_in_out_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:src="#drawable/ic_default_profile" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/recycle_txt_acc_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_number"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_very_small" />
<TextView
android:id="#+id/recycle_txt_acc_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_name"
android:textColor="#color/colorCyan"
android:textSize="#dimen/text_size_very_small" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#drawable/border_grey_curve"
android:text="Selasa"
android:textAllCaps="false"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_weight=".2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:background="#drawable/ic_arrow_right"
android:gravity="center"
android:textColor="#color/colorBlack"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="86dp"
android:layout_height="29dp"
android:background="#drawable/border_grey_curve"
android:drawablePadding="5dp"
android:drawableRight="#drawable/ic_arrow_bottom"
android:singleLine="true"
android:text="Kamis"
android:textAllCaps="false"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

How to align textviews regarding to the layout background

I would like to know if there is a way to place all the textviews that start with little bit space regarding the layout they located. For example I want that in the follwoing image all the textvies will not touch in the border of layout sucah as the word "place","location","Between","When" are doing.
This is current situation:
and this is my xml code:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout 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:id="#+id/relativlayoutGcmMessage"
android:background="#ffffff">
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/separatorUp"
android:visibility="visible"
android:background="#FF0000"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:id="#+id/textlayout"
android:layout_marginTop="5dp"
android:layout_below="#+id/separatorUp"
android:background="#drawable/edit_text_style_focused"
android:layout_margin="10dp"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User ,"
android:gravity="center"
android:id="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:textSize="20sp"
android:textColor="#FF0000" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this is the message"
android:textSize="20sp"
android:layout_marginLeft="5dp"
android:layout_below="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#000000" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:text="Join"
android:id="#+id/ButtonJoin"
android:textColor="#ffffff"
android:background="#606060"
android:layout_margin="10dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
>
</Button>
<Button
android:text="Deny"
android:id="#+id/ButtonDeny"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textColor="#ffffff"
android:background="#606060"
>
</Button>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:id="#+id/relativeLayoutTextVals"
android:layout_marginTop="20dp"
android:layout_margin="10dp"
android:background="#drawable/edit_text_style_focused"
android:layout_below="#+id/textlayout"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:id="#+id/row2"
android:layout_below="#+id/row1"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Between:"
android:id="#+id/textViewbtwn"
android:textColor="#FF0000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_weight="0.62" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Time"
android:id="#+id/textViewtime"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_weight="1.45"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:id="#+id/row3"
android:layout_below="#+id/row2"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Location:"
android:id="#+id/textViewloc"
android:textStyle="bold"
android:textColor="#FF0000"
android:textSize="20sp"
android:layout_weight="1" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="place"
android:layout_marginLeft="10dp"
android:id="#+id/textViewPlace"
android:textSize="20sp"
android:layout_weight="2.28"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:id="#+id/row1"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="When:"
android:id="#+id/textViewWhen"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#FF0000"
android:layout_weight="51.15" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Date"
android:layout_marginLeft="10dp"
android:id="#+id/textViewDate"
android:textSize="20sp"
android:layout_weight="115.29"
android:textColor="#000000" />
</TableRow>
</RelativeLayout>
</RelativeLayout>
Try another approach as follows , it works as per your requirement
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativlayoutGcmMessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<View
android:id="#+id/separatorUp"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="25dp"
android:background="#FF0000"
android:visibility="visible" />
<RelativeLayout
android:id="#+id/textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/separatorUp"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:padding="10dp">
<TextView
android:id="#+id/textViewUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="User ,"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/textViewUser"
android:layout_marginLeft="5dp"
android:text="this is the message"
android:textColor="#000000"
android:textSize="20sp" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:orientation="horizontal">
<Button
android:id="#+id/ButtonJoin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#606060"
android:text="Join"
android:textColor="#ffffff"></Button>
<Button
android:id="#+id/ButtonDeny"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#606060"
android:text="Deny"
android:textColor="#ffffff">
</Button>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayoutTextVals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textlayout"
android:layout_margin="10dp"
android:layout_marginTop="20dp">
<LinearLayout
android:id="#+id/row2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/row1"
android:layout_margin="5dp">
<TextView
android:id="#+id/textViewbtwn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Between:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewtime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="Time"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/row3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/row2"
android:layout_margin="5dp">
<TextView
android:id="#+id/textViewloc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Location:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewPlace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="place"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/row1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center"
android:layout_margin="5dp"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:id="#+id/textViewWhen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="When:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="Date"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

Text size is not getting changed for different screen layouts?

I am trying to make my app multi screen supportable for that I have created different layout folders like layout-large , layout-small ,layout-xlarge , layout-sw320dp , layout-sw480dp , I have set text size in sp in each folder and i have mentioned different text sizes for every layout folder but text is not getting changed.
Here is my xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/gray_pager"
android:orientation="vertical"
>
<LinearLayout
android:id="#+id/firstscreen_call_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/call_list_1"
>
<TextView
android:id="#+id/call_list_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="Call List"
android:textSize="32sp" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitXY"
android:src="#drawable/cm_phone_icon"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/call_list_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:id="#+id/call_list_client_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="350" />
<TextView
android:id="#+id/call_list_client_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Clients 99 Priority" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#color/gray_bg" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/call_list_service_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="3250" />
<TextView
android:id="#+id/call_list_service_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:maxLines="2"
android:text="Servicing Contacts" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/call_list_assigned_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="250" />
<TextView
android:id="#+id/call_list_assigned_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Assigned Contacts" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/call_list_custom_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="6" />
<TextView
android:id="#+id/call_list_custom_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Custom List" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/firstscreen_client_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/client_note_1">
<TextView
android:id="#+id/client_note_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="Client Note"
android:textSize="32sp"
android:textStyle="normal" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitXY"
android:src="#drawable/cm_note_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/client_note_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:id="#+id/client_note_notes_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="10" />
<TextView
android:id="#+id/client_note_notes_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:maxLines="2"
android:text="Notes Logged Today" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/client_note_meeting_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:text="7" />
<TextView
android:id="#+id/client_note_meeting_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:maxLines="2"
android:text="Meetings Schedule" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/client_note_phone_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="6" />
<TextView
android:id="#+id/client_note_phone_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Phone Calls" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/client_note_email_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="4" />
<TextView
android:id="#+id/client_note_email_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Email(s) Sent" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/firstscreen_to_do_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/to_do_list_1">
<TextView
android:id="#+id/todolist_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="To-Do List"
android:textSize="32sp" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:src="#drawable/cm_todo_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/to_do_list_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_open_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="20" />
<TextView
android:id="#+id/todolist_open_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Open Task" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_expire_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="5" />
<TextView
android:id="#+id/todolist_expire_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Expiring Today" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_direct_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="25" />
<TextView
android:id="#+id/todolist_direct_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Directed Calls" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#color/gray_bg" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_action_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:text="2" />
<TextView
android:id="#+id/todolist_action_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:maxLines="2"
android:text="Actions Pending" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/firstscreen_road_show"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/roadshow_1">
<TextView
android:id="#+id/roadshow_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="Roadshow"
android:textSize="32sp" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitXY"
android:src="#drawable/cm_roadshow_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/roadshow_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_meeting_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="10" />
<TextView
android:id="#+id/roadshow_meeting_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="Meetings Schedule" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_ongoing_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="5" />
<TextView
android:id="#+id/roadshow_ongoing_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:text="Ongoing Roadshow" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_future_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="1" />
<TextView
android:id="#+id/roadshow_future_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="Future Roadshow" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_mtoday_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="2" />
<TextView
android:id="#+id/roadshow_mtoday_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="Meetings Today" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
For best practice for text size we need to simply define the text size is sp .
and we should set text as below
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.textSize));

Facing an issue with listview display

I am having five columns displaying data,the issue i am facing is the fifth column data is not visible its getting hidden as well the column heading and the data are not getting properly aligned.Following is my xml for data display
<TextView
android:id="#+id/textView1"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="TextView" />
<TextView
android:id="#+id/textViewStyle"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="23" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView2"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="TextView" />
<TextView
android:id="#+id/textView21"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="23" />
<TextView
android:id="#+id/textView22"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:text="23" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView3"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="455" />
<TextView
android:id="#+id/textView31"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="554" />
<TextView
android:id="#+id/textView32"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="755" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView4"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="6654" />
<TextView
android:id="#+id/textView41"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="7676" />
<TextView
android:id="#+id/textView42"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:text="7765" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="12" />
<TextView
android:id="#+id/textView51"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="45" />
<TextView
android:id="#+id/textView52"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="#000000"
android:textSize="10dp"
android:text="644" />
</LinearLayout>
</LinearLayout>
and the listview xml is has below
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#android:color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="12345617890" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:fontFamily="#android:color/black"
android:text="Ramakrisha Tripati" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="9876543210" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_weight="1"
android:layout_margin="10dp"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="13/1/2015" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Rohit Sharma" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="55dp"
android:orientation="horizontal"
android:background="#F5D8BA">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item#\nstyle#"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M Wt\nD Wt\nCS Wt"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Making\nD Rate\nCS Rate"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Margin\nDis %\nDiscount"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GT\nFSP"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="#00000000"
android:dividerHeight="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textColor="#000000"
android:text="Comment" />
<EditText
android:id="#+id/editText2"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:ems="10"
android:hint="Comment goes here"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:orientation="horizontal">
<Button
android:id="#+id/buttonAcc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:padding="10dp"
android:textColor="#000000"
android:background="#drawable/mybutton"
android:layout_marginLeft="20dp"
android:text="Accept" />
<Button
android:id="#+id/buttonRej"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:padding="10dp"
android:textColor="#000000"
android:background="#drawable/mybutton"
android:layout_marginLeft="100dp"
android:text="Reject" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content" android:orientation="vertical">
because of that
why you not use tablelayout?
Just replace your All Linear Layouts under "xml for data display"
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:orientation="vertical">
With this
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
You can see your fifth Layout.

Categories

Resources