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>
Related
I have this RelativeLayout
<?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:orientation="vertical"
tools:context=".ui.StoreVisitActivity">
<ScrollView
android:id="#+id/scrollable"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/_8sdp"
android:layout_marginRight="#dimen/_8sdp"
android:orientation="vertical">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:orientation="horizontal">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/_55sdp"
android:layout_height="#dimen/_55sdp"
android:src="#drawable/person" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_4sdp"
android:text="Paul Phoenix"
android:textColor="#color/main_blue"
android:textSize="#dimen/_14sdp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_4sdp"
android:text="PX2350"
android:textColor="#color/main_blue"
android:textSize="#dimen/_10sdp"
android:textStyle="bold" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
<ImageView
android:layout_width="#dimen/_60sdp"
android:layout_height="#dimen/_30sdp"
android:layout_gravity="center"
android:src="#drawable/company_logo" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:layout_marginBottom="#dimen/_2sdp"
android:background="#drawable/bg_border_radius"
android:orientation="vertical"
android:padding="#dimen/_16sdp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_20sdp"
android:layout_marginTop="#dimen/_4sdp"
android:background="#color/main_blue"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Day, Date"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:background="#color/black_5"
android:orientation="horizontal"
android:padding="#dimen/_8sdp">
<TextView
android:id="#+id/txtTanggal"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="0"
android:textAllCaps="true"
android:textSize="#dimen/_7sdp" />
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/input_search"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/rectangle_input"
android:hint="Search Name Outlet"
android:inputType="text"
android:paddingHorizontal="#dimen/_10sdp"
android:textSize="#dimen/_7sdp" />
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cardBackgroundColor="#color/blue_1"
app:cardCornerRadius="#dimen/_8sdp"
app:cardUseCompatPadding="true">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="#+id/btnSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="#dimen/_8sdp">
<ImageView
android:layout_width="#dimen/_15sdp"
android:layout_height="#dimen/_15sdp"
android:src="#drawable/ic_search" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_20sdp"
android:background="#color/main_blue"
android:orientation="horizontal"
android:padding="#dimen/_4sdp">
<TextView
android:id="#+id/txtNo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:gravity="center"
android:maxLines="1"
android:text="No"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp"
android:textStyle="normal" />
<TextView
android:id="#+id/txtQtyInbound"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Code"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<TextView
android:id="#+id/txtDesc"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Store Name"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<TextView
android:id="#+id/txtQtyScan"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Address"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<TextView
android:id="#+id/txtSelect"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Select"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
</LinearLayout>
<cz.kinst.jakub.view.SimpleStatefulLayout
android:id="#+id/stateful"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/listPlanJourney"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:itemCount="4" />
</cz.kinst.jakub.view.SimpleStatefulLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="#+id/llButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="#dimen/_8sdp"
android:layout_marginTop="#dimen/_16sdp"
android:layout_marginRight="#dimen/_8sdp"
android:layout_marginBottom="#dimen/_10sdp"
android:orientation="horizontal">
<Button
android:id="#+id/btnExit"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_weight="1"
android:background="#drawable/rectangle_button"
android:text="Exit"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_marginLeft="#dimen/_4sdp"
android:layout_weight="1"
android:background="#drawable/rectangle_button"
android:text="Start Visit"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/_7sdp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</RelativeLayout>
The RecyclerView may contains lots of items (say > 80), that why I put it inside a ScrollView. And I want the Buttons to stay permanent on the bottom of the screen, that's why I use android:layout_alignParentBottom="true". But when I run in, the result is not what I expect. Turns out the Buttons are actually "floating" on top of the ScrollView, like this:
What I want is the LinearLayout containing the Buttons stuck at the buttom, and the rest above it are fully occupied by the ScrollView. How to fix this?
I recommended you use ConstraintLayout and avoid nested layout as much as you can. I have modified your code as little as possible just to fit your needs like below(replace margin/padding back to your desire):
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/layout_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:src="#drawable/ic_notification" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:text="Paul Phoenix"
android:textColor="#0000FF"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:text="PX2350"
android:textColor="#0000FF"
android:textSize="10dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="#drawable/ic_notification" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="2dp"
android:background="#drawable/bg_pb"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintTop_toBottomOf="#id/layout_1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginTop="4dp"
android:background="#0000FF"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Day, Date"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="#000000"
android:orientation="horizontal"
android:padding="8dp">
<TextView
android:id="#+id/txtTanggal"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="0"
android:textAllCaps="true"
android:textSize="7dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/layout_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="#id/layout_2">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/input_search"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/ic_notification"
android:hint="Search Name Outlet"
android:inputType="text"
android:paddingHorizontal="10dp"
android:textSize="7dp" />
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cardBackgroundColor="#0000AA"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:id="#+id/btnSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="#drawable/ic_notification" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:id="#+id/layout_header"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="#0000FF"
android:orientation="horizontal"
android:padding="4dp"
app:layout_constraintTop_toBottomOf="#id/layout_search">
<TextView
android:id="#+id/txtNo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:gravity="center"
android:maxLines="1"
android:text="No"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp"
android:textStyle="normal" />
<TextView
android:id="#+id/txtQtyInbound"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Code"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<TextView
android:id="#+id/txtDesc"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:gravity="center"
android:maxLines="1"
android:text="Store Name"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<TextView
android:id="#+id/txtQtyScan"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Address"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<TextView
android:id="#+id/txtSelect"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="center"
android:maxLines="1"
android:text="Select"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="7dp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/listPlanJourney"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#id/llButtons"
app:layout_constraintTop_toBottomOf="#id/layout_header"
tools:itemCount="4" />
<LinearLayout
android:id="#+id/llButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="#+id/btnExit"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_weight="1"
android:background="#drawable/bg_pb"
android:text="Exit"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="7dp" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:background="#drawable/bg_pb"
android:text="Start Visit"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="7dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Im trying to make an app in android studio. I have a textview with a circular background. The thing is that when i install it on ta physical device the Text view goes of the screen.
Hers the preview in android studio:
The Xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
android:background="#drawable/top_bar">
<TextView
android:id="#+id/textView3"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_weight="0"
android:drawableLeft="#drawable/ic_keyboard_arrow_left_black_24dp"
/>
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center_vertical|start"
android:text="App name and image"
android:textColor="#FFFFFF"
android:textSize="30dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Pakistan vs Australia T20"
android:textColor="#ffff"
android:textSize="24dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:background="#ffff"
android:orientation="vertical"
android:layout_marginLeft="47dp"
android:layout_marginRight="47dp"></LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="300dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="247dp"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Match Odds"
android:textColor="#ffff"
android:textSize="17dp" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:paddingLeft="10dp"
android:text="Favourite"
android:textColor="#ffff"
android:textSize="17dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView12"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView11"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView10"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="WestIndies"
android:textColor="#ffff"
android:textSize="16dp"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView4"
android:layout_width="100dp"
android:layout_height="1dp"
android:layout_marginLeft="6dp"
android:background="#color/margins"
android:text="TextView" />
<TextView
android:id="#+id/textView7"
android:layout_width="100dp"
android:layout_height="1dp"
android:layout_marginLeft="30dp"
android:background="#color/margins"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Session"
android:textColor="#ffff"
android:textSize="17dp" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Runs/Balls"
android:textColor="#ffff"
android:textSize="17dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView17"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#FF0000"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView18"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView19"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="0dp"
android:orientation="vertical"
>
<TextView
android:id="#+id/TextViewID"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginTop="80dp"
android:layout_marginLeft="35dp"
android:background="#drawable/green_circle"
android:gravity="center"
android:text="2"
android:textColor="#ff2800"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
What im getting on the screen:
ive tried using different devices with different screen sizes but all give the same result. How can i solve this.
TIA..!!!
I think it's because the LinearLayout where that round TextView is, is actually a child of another LinearLayout with horizontal orientation, and you have another empty LinearLayout of width 250dp right before it, which pushes the relevant layout out of screen. Can you try removing the empty LinearLayout and see if it helps?
My app's button positions changes on different devices. Sometimes buttons are getting bigger, sometimes getting smaller,sometimes a part of buttons arent visible. I use vertical linear layout. Buttons are in drawable folder and button sizes are 227x231 px.
There are some sample screenshots. Pixel 2 - Pixel 3a - Mi 9T Pro
How can i fix ?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/back4">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="95dp"
android:background="#drawable/a"
android:orientation="horizontal">
<TextView
android:id="#+id/teamName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:fontFamily="#font/andika"
android:paddingTop="20dp"
android:text="Team 1"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="20sp" />
<TextView
android:id="#+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:paddingLeft="50dp"
android:text="5"
android:textColor="#303f9f"
android:textSize="36sp"
android:textStyle="bold" />
<TextView
android:id="#+id/roundText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:fontFamily="#font/andika"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Round 1/5"
android:textAlignment="viewStart"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<TextView
android:id="#+id/timeText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="20dp"
android:layout_marginRight="100dp"
android:fontFamily="#font/arsenal_bold"
android:text="60"
android:textAlignment="center"
android:textColor="#E2DADA"
android:textSize="40sp"
android:textStyle="bold" />
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="0"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="419dp"
android:background="#drawable/game4"
android:orientation="vertical">
<TextView
android:id="#+id/guessWord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="80dp"
android:text="Guess "
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="38sp"
android:textStyle="bold" />
<TextView
android:id="#+id/translateWord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="80dp"
android:text="(Translate)"
android:textAlignment="center"
android:textColor="#D0FFFFFF"
android:textSize="26sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tabuWord1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="35dp"
android:layout_marginEnd="80dp"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
<TextView
android:id="#+id/tabuWord2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="80dp"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
<TextView
android:id="#+id/tabuWord3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="80dp"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="123dp"
android:orientation="horizontal">
<Button
android:id="#+id/tabuButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="30dp"
android:layout_weight="1"
android:background="#drawable/tabubutton2" />
<Button
android:id="#+id/passButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="30dp"
android:layout_weight="1"
android:background="#drawable/pasbutton2" />
<Button
android:id="#+id/trueButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="30dp"
android:layout_weight="1"
android:background="#drawable/truebutton2" />
</LinearLayout>
</LinearLayout>
You should use ScrollView but if you don't want the screen scrolling you should rebuild it using ConstraintLayout
You can do it with something like this:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
style="#style/parent"
tools:ignore="MissingConstraints">
.......
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
style.xml
<style name="parent">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
I think this should work on all screens
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/back4">
<ScrollView
style="#style/parent"
tools:ignore="MissingConstraints,ScrollViewCount">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="95dp"
android:background="#drawable/a"
android:orientation="horizontal">
<TextView
android:id="#+id/teamName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:fontFamily="#font/andika"
android:paddingTop="20dp"
android:text="Team 1"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="20sp" />
<TextView
android:id="#+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:paddingLeft="50dp"
android:text="5"
android:textColor="#303f9f"
android:textSize="36sp"
android:textStyle="bold" />
<TextView
android:id="#+id/roundText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:fontFamily="#font/andika"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Round 1/5"
android:textAlignment="viewStart"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<TextView
android:gravity="center"
android:layout_gravity="center"
android:id="#+id/timeText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/arsenal_bold"
android:text="60"
android:textAlignment="center"
android:textColor="#E2DADA"
android:textSize="40sp"
android:textStyle="bold" />
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="0"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/game4"
android:orientation="vertical">
<TextView
android:layout_margin="25dp"
android:id="#+id/guessWord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Guess "
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="38sp"
android:textStyle="bold" />
<TextView
android:layout_margin="15dp"
android:id="#+id/translateWord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="(Translate)"
android:textAlignment="center"
android:textColor="#D0FFFFFF"
android:textSize="26sp"
android:textStyle="bold" />
<TextView
android:layout_margin="15dp"
android:id="#+id/tabuWord1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
<TextView
android:layout_margin="15dp"
android:id="#+id/tabuWord2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
<TextView
android:layout_margin="15dp"
android:id="#+id/tabuWord3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_margin="25dp"
android:id="#+id/tabuButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/tabubutton2" />
<Button
android:layout_margin="25dp"
android:id="#+id/passButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/pasbutton2" />
<Button
android:layout_margin="25dp"
android:id="#+id/trueButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/truebutton2" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
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.
I am facing 2 issues
1.My text view is overlapping. ID is textView7 and name is OrderStatus
2.I am trying to add the divider using the view it is also not working
NOTE:divider is working i have added the android:layout_below property
MyActivity.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.lenovo.jdstudio.UpdateOrderStatusActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/updateOrderToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:orientation="vertical"
android:theme="#style/ThemeOverlay.AppCompat.Dark" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/Fname_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dimen_10dp"
android:layout_marginTop="#dimen/dimen_10dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView2"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="First Name "
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/Update_FName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dimen_25dp"
android:freezesText="true"
android:gravity="center_horizontal"
android:text="Aakash"
android:textColor="#color/color_3"
android:textSize="16sp"
android:textStyle="normal|italic" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray"
android:layout_marginTop="#dimen/dimen_5dp"
android:layout_below="#id/Fname_LinearLayout"/>
<LinearLayout
android:id="#+id/Lname_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/Fname_LinearLayout"
android:layout_marginLeft="#dimen/dimen_10dp"
android:layout_marginTop="#dimen/dimen_15dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView3"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Last Name :"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/Update_LName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dimen_25dp"
android:text="Bidlan"
android:textColor="#color/color_3"
android:textSize="16sp"
android:textStyle="italic" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="#dimen/dimen_5dp"
android:layout_below="#id/Lname_LinearLayout"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/orderStatus_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/Lname_LinearLayout"
android:layout_marginLeft="#dimen/dimen_10dp"
android:layout_marginTop="#dimen/dimen_15dp"
android:orientation="horizontal"
android:layout_marginBottom="#dimen/dimen_2dp">
<TextView
android:id="#+id/textView7"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Order Status"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/orderStatusSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dimen_25dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="#dimen/dimen_5dp"
android:layout_below="#id/orderStatus_LinearLayout"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/email_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/orderStatus_LinearLayout"
android:layout_marginLeft="#dimen/dimen_10dp"
android:layout_marginTop="#dimen/dimen_15dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView4"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Email"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/UpdateOrderEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dimen_25dp"
android:text="123#gmail.com"
android:textColor="#color/color_3"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray"
android:layout_marginTop="#dimen/dimen_5dp"
android:layout_below="#id/email_LinearLayout"/>
<LinearLayout
android:id="#+id/phoneno_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/email_LinearLayout"
android:layout_marginLeft="#dimen/dimen_10dp"
android:layout_marginTop="#dimen/dimen_15dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView5"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Phone No."
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/update_phoneNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dimen_25dp"
android:text="1234567890"
android:textColor="#color/color_3"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray"
android:layout_marginTop="#dimen/dimen_5dp"
android:layout_below="#id/phoneno_LinearLayout"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/phoneno_LinearLayout"
android:layout_marginLeft="#dimen/dimen_10dp"
android:layout_marginTop="#dimen/dimen_15dp">
<TextView
android:id="#+id/textView6"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Photo Description"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/Update_photoDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dimen_25dp"
android:text="id passport"
android:textColor="#color/color_3"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<Button
android:id="#+id/UpdateOrderSatatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="7dp"
android:text="Update Order" />
<Button
android:id="#+id/deleteOrder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/UpdateOrderSatatus"
android:layout_alignParentStart="true"
android:layout_marginBottom="88dp"
android:text="Delete Order" />
<ProgressBar
android:id="#+id/updateOrderProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>
I tried giving bottom padding first and then bottom margin. it doesn't work.
Thanks for reading the Question.
waiting for the favorable reply...
I have made some changes in this XML file Please try this :-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/updateOrderToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:orientation="vertical"
android:theme="#style/ThemeOverlay.AppCompat.Dark" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/Fname_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView2"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="First Name"
android:layout_gravity="center"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/Update_FName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="25dp"
android:freezesText="true"
android:gravity="center_horizontal"
android:text="Aakash"
android:textColor="#000"
android:textSize="16sp"
android:textStyle="normal|italic" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/Lname_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/Fname_LinearLayout"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView3"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Last Name"
android:textAllCaps="true"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/Update_LName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="Bidlan"
android:textColor="#000"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="italic" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/orderStatus_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/Lname_LinearLayout"
android:layout_marginBottom="4dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView7"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Order Status"
android:layout_gravity="center"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/orderStatusSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/email_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/orderStatus_LinearLayout"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView4"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Email"
android:textAllCaps="true"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/UpdateOrderEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="123#gmail.com"
android:textColor="#000"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:id="#+id/phoneno_LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/email_LinearLayout"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView5"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Phone No."
android:textAllCaps="true"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/update_phoneNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="1234567890"
android:textColor="#000"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/phoneno_LinearLayout"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp">
<TextView
android:id="#+id/textView6"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="Photo Description"
android:layout_gravity="center"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/Update_photoDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="id passport"
android:layout_gravity="center"
android:textColor="#000"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<Button
android:id="#+id/UpdateOrderSatatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="7dp"
android:text="Update Order" />
<Button
android:id="#+id/deleteOrder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/UpdateOrderSatatus"
android:layout_alignParentStart="true"
android:layout_marginBottom="88dp"
android:text="Delete Order" />
<ProgressBar
android:id="#+id/updateOrderProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</LinearLayout>
</LinearLayout>
There are too many rows for one screen in a non-scrollable layout. You should add a ScrollView to avoid problems with shorter screens or split the views in several ViewGroups / screens (for example by using some collapsible containers or ViewPager).
If that is not possible you could set weights to the TextViews' height and use the auto size text
<TextView
android:layout_width="105dp"
android:layout_height="0dp"
android:layout_weight="1"
android:autoSizeTextType="uniform" />
Also consider using a layout that is more suitable for the design, such as GridLayout or ConstraintLayout to avoid hard coding the TextView width.