I have the following xml file -
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/white"
android:orientation="vertical">
<ImageView
android:id="#+id/fragment_terms_and_conditions_back_image"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:src="#drawable/arrow_left" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:text="#string/fragment_terms_and_conditions_terms_and_conditions"
android:textColor="#color/black"
android:textSize="20sp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="#dimen/main_app_top_margin_15dp"
android:layout_marginEnd="24dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/roboto_bold"
android:text="#string/terms_and_conditions_fragment_overview"
android:textColor="#color/color_light_gray"
android:textSize="16sp" />
<TextView
android:layout_width="match_parent"
android:textSize="15sp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/main_app_top_margin_15dp"
android:text="#string/terms_and_conditions_fragment_overview_content"
android:textColor="#color/black" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:background="#color/color_list_divider_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/main_app_top_margin_15dp"
android:fontFamily="#font/roboto_bold"
android:text="#string/terms_and_conditions_fragment_terms_prohibited_use"
android:textColor="#color/color_light_gray"
android:textSize="16sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/main_app_top_margin_15dp"
android:text="#string/terms_and_conditions_fragment_terms_prohibited_use_content"
android:textColor="#color/black" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:background="#color/color_list_divider_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/roboto_bold"
android:text="#string/terms_and_conditions_fragment_terms_post_sales_support"
android:textColor="#color/color_light_gray"
android:textSize="16sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/main_app_top_margin_15dp"
android:text="#string/terms_and_conditions_fragment_terms_post_sales_support_content"
android:textColor="#color/black" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:background="#color/color_list_divider_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/roboto_bold"
android:text="#string/terms_and_conditions_fragment_terms_illegal_distribution"
android:textColor="#color/color_light_gray"
android:textSize="16sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/main_app_top_margin_15dp"
android:layout_marginBottom="30dp"
android:text="#string/terms_and_conditions_fragment_terms_illegal_distribution_content"
android:textColor="#color/black" />
</LinearLayout>
</ScrollView>
</LinearLayout>
but the Scrollview does not show the scrollbar like the following picture -
I tried to add android:fadeScrollbars="false" and android:scrollbarFadeDuration="0" and nothing works
I tried also to put the fadescrollbars to true and add some durations to the fade and it does not have any effect
what am I missing?
Related
I am trying to create a simple home page for my application. However, I have a performance issue on my home page when trying to scroll my page. Could you please tell me what I am doing wrong or what I can do better in order to have a smooth scroll? (My images sizes are around 100kb on average.) I have tried to minimize the sizes of my images, using a recycler view, decreasing the amount of the LinearLayouts that I used, using ConstraintLayout instead of LinearLayout but none of these worked for me. Thanks for your help!
Here is the screenshot of my home page:
My Home Page Screenshot Link
Here is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="#F6F0E2"
tools:context=".HomeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/nameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:text="Bilgiler alınamadı"
android:textColor="#color/black"
android:textSize="17sp"
android:textStyle="italic" />
<!-- SİPARİŞ VE BİLGİLER -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="#ffffff"
android:orientation="vertical">
<!-- TİTLE -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:text="SİPARİŞ VE BİLGİLER"
android:textColor="#5c5c5c"
android:textSize="13sp"
android:textStyle="bold" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- CHECK-IN -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:padding="4dp"
android:src="#drawable/check" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="22dp"
android:text="Check-In"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:text="QR Kod Okut"
android:textColor="#949494"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- MENÜ -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:padding="4dp"
android:src="#drawable/menu" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:text="Menü"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:text="Görmek için tıklayınız"
android:textColor="#949494"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- SİPARİŞLER -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:padding="4dp"
android:src="#drawable/siparisler" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:text="Siparişler"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:text="Siparişlerinize göz atın"
android:textColor="#949494"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- WC -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginLeft="15dp"
android:padding="4dp"
android:src="#drawable/wc" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:text="WC Bay - AQQQQ"
android:textColor="#color/black"
android:textSize="12dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp"
android:text="WC Bayan - AQQQQQ"
android:textColor="#color/black"
android:textSize="12dp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- RESTORAN -->
<TableRow android:layout_marginBottom="10dp">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginLeft="15dp"
android:padding="4dp"
android:src="#drawable/rest" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:text="Restoran - AQQQQ"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp"
android:text="Sıra Al - Ort: 31 dk"
android:textColor="#949494"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
</TableLayout>
</androidx.cardview.widget.CardView>
<!-- ÇAĞRI VE YARDIM -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="#ffffff">
<!-- TİTLE -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:text="ÇAĞRI VE YARDIM"
android:textColor="#5c5c5c"
android:textSize="13sp"
android:textStyle="bold" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- GARSON ÇAĞIR -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:padding="4dp"
android:src="#drawable/waiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="22dp"
android:text="Garson Çağır"
android:textColor="#color/black"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- HESAP İSTE -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:padding="4dp"
android:src="#drawable/wallet" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:text="Hesap İste"
android:textColor="#color/black"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- HALKLA İLİŞKİLER -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:padding="4dp"
android:src="#drawable/hr" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:text="Halkla İlişkiler"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:text="Yardım İste"
android:textColor="#949494"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
</TableLayout>
</androidx.cardview.widget.CardView>
<!-- ÇAĞRI VE YARDIM -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="#ffffff">
<!-- TİTLE -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:text="ÇAĞRI VE YARDIM"
android:textColor="#5c5c5c"
android:textSize="13sp"
android:textStyle="bold" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- GARSON ÇAĞIR -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:padding="4dp"
android:src="#drawable/waiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="22dp"
android:text="Garson Çağır"
android:textColor="#color/black"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- HESAP İSTE -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:padding="4dp"
android:src="#drawable/wallet" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:text="Hesap İste"
android:textColor="#color/black"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
<!-- HALKLA İLİŞKİLER -->
<TableRow>
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginStart="15dp"
android:padding="4dp"
android:src="#drawable/hr" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:text="Halkla İlişkiler"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:text="Yardım İste"
android:textColor="#949494"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#c0c0c0" />
</TableLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</ScrollView>
Try using Recyclerview instead of Scrollview. This way you will use much less resources.
So coding this way, each row in your table will be an element in Recyclerview.
main layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:clipToPadding="true"
android:paddingStart="16dp"
android:paddingEnd="32dp">
<include
android:id="#+id/sideBar"
layout="#layout/layout_side_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<TextView
android:id="#+id/tv_name"
style="#style/ListItemText"
android:layout_alignParentTop="true"
android:layout_marginTop="21dp"
android:layout_toEndOf="#id/sideBar"
android:gravity="center"
android:letterSpacing="-0.02"
android:text="#string/xyz"
android:textColor="#color/blue"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_name"
android:layout_marginStart="8dp"
android:layout_marginTop="9dp"
android:layout_marginBottom="18dp"
android:layout_toEndOf="#id/sideBar"
android:background="#drawable/bg_text_new"
android:drawableStart="#drawable/ic_wait_icon"
android:drawablePadding="14dp"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:lineSpacingExtra="6sp"
android:paddingStart="14dp"
android:paddingTop="9dp"
android:paddingEnd="14dp"
android:paddingBottom="9dp"
android:text="#string/abc"
android:textColor="#color/primary"
android:textSize="13sp" />
</RelativeLayout>
layout_side_bar.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<View
android:id="#+id/v_lineTop"
android:layout_width="2dp"
android:layout_height="20dp"
android:background="#color/green" />
<TextView
android:id="#+id/tv_number"
style="#style/ListItemNumber"
android:background="#drawable/bg_circle"
tools:text="2" />
<View
android:id="#+id/v_lineBottom"
android:layout_width="2dp"
android:layout_height="match_parent"
android:background="#color/grey" />
</LinearLayout>
The view with id v_lineBottom in the layout_side_bar that is included in the main layout is invisible.
It only shows up if I give a specific height to the v_lineBottom view or to the included android:id="#+id/sideBar"
I am using the main layout as a recycler view item
I am getting a view like this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:clipToPadding="true"
android:paddingStart="16dp"
android:paddingEnd="32dp"
android:paddingRight="32dp"
android:paddingLeft="16dp">
<include
android:id="#+id/sideBar"
layout="#layout/layout_side_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<TextView
android:id="#+id/tv_name"
android:layout_alignParentTop="true"
android:layout_marginTop="21dp"
android:layout_toEndOf="#id/sideBar"
android:gravity="center"
android:letterSpacing="-0.02"
android:text="xys"
android:textColor="#color/blue"
android:textStyle="bold"
android:layout_toRightOf="#id/sideBar"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView
android:id="#+id/tv_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_name"
android:layout_marginStart="8dp"
android:layout_marginTop="9dp"
android:layout_marginBottom="18dp"
android:layout_toEndOf="#id/sideBar"
android:drawablePadding="14dp"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:lineSpacingExtra="6sp"
android:paddingStart="14dp"
android:paddingTop="9dp"
android:paddingEnd="14dp"
android:paddingBottom="9dp"
android:text="#string/acre"
android:textColor="#color/black"
android:textSize="13sp"
android:layout_marginLeft="8dp"
android:layout_toRightOf="#id/sideBar" />
</RelativeLayout>
and layout_side_bar
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<View
android:id="#+id/v_lineTop"
android:layout_width="2dp"
android:layout_height="20dp"
android:background="#color/blue" />
<TextView
android:id="#+id/tv_number"
tools:text="2"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<View
android:id="#+id/v_lineBottom"
android:layout_width="2dp"
android:layout_height="match_parent"
android:background="#color/black" />
</LinearLayout>
can you show graphical representation of your view the way you want to achieve..
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.
Wrap content not working and scroll stopped working.
Hi, I'm developing an app for Android and I have noticed that my app works perfectly in smartphones, however in Tablets in Portrait mode it adds a huge space and the ScrollView stops working.
Smartphone's view:
Tablet's view:
My XML code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/descAbout"
android:layout_marginBottom="10dp"
android:textSize="16sp"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginBottom="10dp"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true">
<ImageView
android:id="#+id/imgSpaceApps"
android:layout_width="wrap_content"
android:layout_height="115dp"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:src="#drawable/spaceApps" />
<ImageView
android:id="#+id/imgNasaLogo"
android:layout_width="wrap_content"
android:layout_height="115dp"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:src="#drawable/nasaLogo" />
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblContact2"
android:layout_marginBottom="5dp" />
<TextView
android:id="#+id/lblOurEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblContactUs"
android:clickable="true"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblVisit"
android:autoLink="web"
android:layout_marginBottom="5dp" />
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblSpecialGreeting"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url7"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url8"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url6"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url5"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url1"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url2"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url3"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url4"
android:layout_marginBottom="10dp" />
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblPPrivacy"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url9"
android:layout_marginBottom="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginBottom="5dp"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:src="#drawable/supernova" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="14sp"
android:text="#string/About6"
android:layout_marginBottom="10dp" />
</LinearLayout>
</ScrollView>
If I remove the properties of:
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
The result is the same:
I am testing in Android 6 and 7, also, the minimum SDK is 21.
Does anyone have experienced this situation? Thanks for your help.
As mentioned in my comment the cause is the RelativeLayout that holds the images.
RelativeLayout can cause unexpected results when used with 'wrap_content' where it will actually try to match its parent and lay out the children at the edges.
In this case, the RelativeLayout is pretty useless anyway; you can remove it and slightly change the attributes of the child LinearLayout:
...
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal"
>
<ImageView
android:id="#+id/imgSpaceApps"
android:layout_width="wrap_content"
android:layout_height="115dp"
android:adjustViewBounds="true"
android:src="#drawable/spaceApps" />
<ImageView
android:id="#+id/imgNasaLogo"
android:layout_width="wrap_content"
android:layout_height="115dp"
android:adjustViewBounds="true"
android:src="#drawable/nasaLogo" />
</LinearLayout>
...
Change it to this :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/descAbout"
android:layout_marginBottom="10dp"
android:textSize="16sp"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginBottom="10dp"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true">
<ImageView
android:id="#+id/imgSpaceApps"
android:layout_width="wrap_content"
android:layout_height="115dp"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:src="#drawable/spaceApps" />
<ImageView
android:id="#+id/imgNasaLogo"
android:layout_width="wrap_content"
android:layout_height="115dp"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:src="#drawable/nasaLogo" />
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblContact2"
android:layout_marginBottom="5dp" />
<TextView
android:id="#+id/lblOurEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblContactUs"
android:clickable="true"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblVisit"
android:autoLink="web"
android:layout_marginBottom="5dp" />
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblSpecialGreeting"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url7"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url8"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url6"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url5"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url1"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url2"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url3"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url4"
android:layout_marginBottom="10dp" />
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="#string/lblPPrivacy"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:autoLink="web"
android:text="#string/url9"
android:layout_marginBottom="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginBottom="5dp"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:src="#drawable/supernova" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="14sp"
android:text="#string/About6"
android:layout_marginBottom="10dp" />
</LinearLayout>
</ScrollView>
I have my xml file. It is a RelativeLayout with a ScrollView and inside the ScrollView I have LinearLayout and many more. The problem is that I can't reach the end of the view, as you can see it end with a "Sign Up" button... But my view is cut by the scroll and I can just see the middle of the button, the other middle is off screen.
So, any suggestions for how can I fix this? How can I work with the ScrollView so it wraps all of my content...
Check it:
<?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="wrap_content"
android:background="#drawable/bg_signup"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".SignUp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:background="#xml/signup_round">
<LinearLayout
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/new_signup" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="#string/signup"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
</LinearLayout>
<EditText
android:id="#+id/first_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="-25dp"
android:hint="#string/first_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/last_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/last_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email_confirmation"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password_confirmation"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/sex"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/sex_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-25dp"
android:entries="#array/sex_array" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/brithday"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:orientation="horizontal">
<Button
android:id="#+id/birthdayBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="#color/fbutton_color_transparent"
android:onClick="showDatePickerDialog"
android:text="#string/birthdayBtn"
android:textAllCaps="false"
android:textColor="#color/colorRB" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="#+id/dateSelectedTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="--/--/--"
android:textColor="#color/colorRB"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingBottom="5dp"
android:text="#string/terms_conditions"
android:textColor="#color/colorRB"
android:textStyle="bold" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" />
</LinearLayout>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="#xml/button_round"
android:onClick=""
android:text="#string/signup"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick=""
android:src="#drawable/close_signup" />
</RelativeLayout>