when i am scrolling down then unnecessary spaces are coming.so pls help me and i am using a scrollView for this activity.This is my .xml file,pls see to it and suggest me what to do because when i am scrolling down that unnecessary space making my app disgusting.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="5dp"
android:paddingRight="5dp"
tools:context="com.example.vishal.a4sa.rubber">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Rubber Bowl"
android:gravity="center"
android:textColor="#01118c"
android:padding="#dimen/activity_horizontal_margin"
android:textStyle="bold"
android:textSize="30dp"
android:id="#+id/tv"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="#+id/image"
android:background="#drawable/image1"
android:layout_below="#+id/textView5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="900dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:id="#+id/content"
android:layout_alignParentBottom="true"
android:layout_alignLeft="#+id/imageView"
android:layout_alignStart="#+id/imageView" />
</LinearLayout>
</ScrollView>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Rubber Bowl"
android:gravity="center"
android:textColor="#01118c"
android:padding="#dimen/activity_horizontal_margin"
android:textStyle="bold"
android:textSize="30dp"
android:id="#+id/tv"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="#+id/image"
android:background="#drawable/image1"
android:layout_below="#+id/textView5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:id="#+id/content"
android:layout_alignParentBottom="true"
android:layout_alignLeft="#+id/imageView"
android:layout_alignStart="#+id/imageView" />
</LinearLayout>
</ScrollView>
Related
I'm designing a Profile Layout. For which I'm using Imageview and RelativeLayout. I'm trying put ImageView on top of RelativeLayout.I used both elevation and android:scaleType="centerCrop" but it shows okay in the design editor but when I compile and run app then ImageView always stays behind the RelativeLayout.
In Design Editor it shows
Which is what I want but in the device, it shows like this
Please help..
Below 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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/layout">
<ImageView
android:id="#+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#000000"
android:scaleType="centerCrop"
android:src="#drawable/nav_menu_heade" />
<ImageView
android:clickable="true"
android:id="#+id/profile"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_below="#+id/header_cover_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-130dp"
android:scaleType="fitStart"
android:elevation="8dp"
android:padding="20dp"
android:src="#drawable/passport" />
<RelativeLayout
android:id="#+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/header_cover_image"
android:background="#eb0772ca"
android:elevation="2dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="Sagar Rawal"
android:textColor="#fff"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/name"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Don't Cry cuz it's over, Smile cuz it happen"
android:textColor="#ffffff"
android:textSize="18sp" />
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/quote"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Jumla, Nepal"
android:textColor="#ffffff"
android:textSize="16sp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Move your profile ImageView below RelativeLayout,
In most layouts(like RelativeLayout and FrameLayout), the z-index is defined by the
order in which the items are added
Your XML should look like this:
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/layout">
<ImageView
android:id="#+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#000000"
android:scaleType="centerCrop"
android:src="#drawable/nav_menu_heade" />
<RelativeLayout
android:id="#+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/header_cover_image"
android:background="#eb0772ca"
android:elevation="2dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="Sagar Rawal"
android:textColor="#fff"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/name"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Don't Cry cuz it's over, Smile cuz it happen"
android:textColor="#ffffff"
android:textSize="18sp" />
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/quote"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Jumla, Nepal"
android:textColor="#ffffff"
android:textSize="16sp" />
</RelativeLayout>
<ImageView
android:clickable="true"
android:id="#+id/profile"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_below="#+id/header_cover_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-130dp"
android:scaleType="fitStart"
android:elevation="8dp"
android:padding="20dp"
android:src="#drawable/passport" />
</RelativeLayout>
</ScrollView>
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/layout">
<ImageView
android:id="#+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#000000"
android:scaleType="centerCrop"
android:src="#drawable/nav_menu_heade" />
<RelativeLayout
android:id="#+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/header_cover_image"
android:background="#eb0772ca"
android:elevation="2dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="Sagar Rawal"
android:textColor="#fff"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/name"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Don't Cry cuz it's over, Smile cuz it happen"
android:textColor="#ffffff"
android:textSize="18sp" />
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/quote"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Jumla, Nepal"
android:textColor="#ffffff"
android:textSize="16sp" />
</RelativeLayout>
//<ImageView should come below <RelativeLayout>
<ImageView
android:clickable="true"
android:id="#+id/profile"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_below="#+id/header_cover_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-130dp"
android:scaleType="fitStart"
android:elevation="8dp"
android:padding="20dp"
android:src="#drawable/passport" />
</RelativeLayout>
</ScrollView>
Put profile <ImageView/> below <RelativeLayout/>
Edit Xml Like This
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/layout">
<ImageView
android:id="#+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#000000"
android:scaleType="centerCrop"
android:src="#drawable/back" />
<RelativeLayout
android:id="#+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/header_cover_image"
android:background="#eb0772ca"
android:elevation="2dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="Sagar Rawal"
android:textColor="#fff"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/name"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Don't Cry cuz it's over, Smile cuz it happen"
android:textColor="#ffffff"
android:textSize="18sp" />
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/quote"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Jumla, Nepal"
android:textColor="#ffffff"
android:textSize="16sp" />
</RelativeLayout>
<ImageView
android:clickable="true"
android:id="#+id/profile"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_below="#+id/header_cover_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-130dp"
android:scaleType="fitStart"
android:elevation="8dp"
android:padding="20dp"
android:src="#drawable/app_icon" />
</RelativeLayout>
</ScrollView>
You can try to call bringToFront() on the view you want to get in the front
view.bringToFront();
I see that you use negative margin, if I were you, I never use negative number for margin, because it makes some problem. please try this way:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:clickable="true"
android:id="#+id/profile"
android:layout_width="200dp"
android:layout_height="200dp"
android:scaleType="fitStart"
android:elevation="8dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:padding="20dp"
android:src="#drawable/ic_launcher_background" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="2">
<ImageView
android:id="#+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_weight="1"
android:background="#000000"
android:scaleType="centerCrop"
android:src="#drawable/ic_launcher_background" />
<RelativeLayout
android:id="#+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#eb0772ca"
android:elevation="2dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="Sagar Rawal"
android:textColor="#fff"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/name"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Don't Cry cuz it's over, Smile cuz it happen"
android:textColor="#ffffff"
android:textSize="18sp" />
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/quote"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Jumla, Nepal"
android:textColor="#ffffff"
android:textSize="16sp" />
</RelativeLayout>
</LinearLayout>
</FrameLayout>
I was also in trouble of that type of problem some days ago.But i resolved this type of problem using some logic.
This is my .xml file . Hope you will understand it.
<ScrollView
android:fillViewport="true"
android:scrollbars="none"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:weightSum="10"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_weight="1.3"
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#color/colorBackFilled">
<com.prymepharm.android.CustomClass.MarkSimonsonRegulerTextView
android:text="#string/pleaeEnterMobno"
android:textColor="#color/colorWhite"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/twenty"
android:textSize="#dimen/ssixteen"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="2.7"
android:id="#+id/relative1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#color/colorBackFilled">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#color/colorBackFilled"
android:layout_weight="1" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#color/colorWhite"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/phn96" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_weight="6"
android:id="#+id/linear2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#color/colorWhite"
android:orientation="vertical">
<com.prymepharm.android.CustomClass.MarkSimonsonSemiTextView
android:id="#+id/phoneNum"
android:layout_marginLeft="#dimen/thirty"
android:layout_marginTop="#dimen/thirty_five"
android:layout_marginStart="#dimen/thirty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/phonenNum"
android:textSize="#dimen/ssixteen" />
<LinearLayout
android:orientation="horizontal"
android:layout_marginStart="#dimen/thirty"
android:layout_marginEnd="#dimen/thirty"
android:layout_width="match_parent"
android:layout_height="#dimen/fifty"
android:layout_marginTop="#dimen/eight"
android:layout_marginBottom="#dimen/eight">
<com.hbb20.CountryCodePicker
android:id="#+id/ccp"
android:layout_marginTop="#dimen/eight"
app:ccp_areaCodeDetectedCountry="true"
app:ccp_contentColor="#color/colorBackFilled"
app:ccpDialog_showNameCode="false"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<android.support.design.widget.TextInputLayout
android:id="#+id/firstName"
android:orientation="horizontal"
android:layout_height="match_parent"
android:layout_width="match_parent">
<EditText
android:id="#+id/entetPhoneNum"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="phone"
android:maxLength="15"
android:singleLine="true"
android:hint="#string/typeInHere" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<com.prymepharm.android.CustomClass.MarkSimonsonSemiTextView
android:id="#+id/send1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/forty"
android:textSize="#dimen/ssixteen"
android:text="#string/send1"/>
<com.prymepharm.android.CustomClass.MarkSimonsonSemiTextView
android:id="#+id/send2"
android:layout_marginTop="#dimen/ten"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/ssixteen"
android:text="#string/send2"/>
<LinearLayout
android:id="#+id/llbottom"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_width="#dimen/eighty"
android:layout_marginBottom="#dimen/hundred"
android:layout_marginTop="#dimen/forty"
android:layout_height="#dimen/eighty">
<ImageView
android:id="#+id/button_round"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/arn96" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
I'm having a hard time aligning my button to the bottom of "login_password"
I've tried endOf and it didn't work at all and align at bottom of parent and none of it seemed to work. I've tried using margin to move it to the bottom but it just breaks the username textbox. Are there any solutions for the problem I'm experiencing?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/myBlue"
android:orientation="vertical"
android:gravity="center"
tools:context="com.vice.jake.ric.fads.view.activites.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/logov3_4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_toEndOf="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
Use Linear Layout(orientation- vertical) with weight when working for Login screen so that it fits fine to all the screen sizes
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/blue"
android:gravity="center"
android:orientation="vertical"
android:weightSum="10">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignParentTop="true"
android:layout_weight="2"
android:src="#drawable/logov3_4" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></View>
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/luxx_edittext"
android:drawableLeft="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/luxx_edittext"
android:drawableLeft="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></View>
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#color/holo_red_light"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"></View>
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:padding="20dp"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor" />
</LinearLayout>
Try this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorAccent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="275dp"
android:src="#drawable/places_ic_search" />
<LinearLayout
android:id="#+id/relativelayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="#color/colorAccent"
android:drawablePadding="15dp"
android:drawableStart="#drawable/places_ic_clear"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:background="#color/colorPrimary"
android:drawablePadding="15dp"
android:drawableStart="#drawable/places_ic_clear"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="#id/login_password"
android:background="#color/colorAccent"
android:text="REGISTER"
android:textColor="#ff00" />
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:text="Don't have an Account? Create one!"
android:textColor="#ff00" />
</RelativeLayout>
OUTPUT
You can use LinearLayout instead of RelativeLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/logov3_4" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_toEndOf="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
You should use layout_below to align button below the password field..I have reformatted your code to add that
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightBlue"
android:orientation="vertical"
android:gravity="center"
tools:context="com.vice.jake.ric.fads.view.activites.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/ic_about" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_below="#id/login_password"
android:layout_marginTop="5dp"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
Try this :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/main_relative"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/container_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/second_container_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/card_linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_toEndOf="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
<TextView
android:layout_width="20dp"
android:layout_height="20dp" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:id="#+id/pay_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
Try below XML Code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/myBlue"
android:orientation="vertical"
android:gravity="center"
tools:context="com.vice.jake.ric.fads.view.activites.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="#id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="#+id/relativelayout1">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/logov3_4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="#+id/relativelayout2">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="#drawable/luxx_edittext"
android:drawableStart="#drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_below="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="#color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
You will get below output.
You are aligning the button to the endOf which means right side of the edittext. You have to align below the edittext layout as below
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
So u should be able to see the button below the login_password
You can use android:layout_below instead of android:layout_toEndOf.
Positions the top edge of this view below the given anchor view ID.
Accommodates top margin of this view and bottom margin of anchor view.
android:layout_below="#id/"
Finally
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/holo_red_light"
android:layout_below="#id/login_password"
android:text="REGISTER"
android:textColor="#color/ghostWhiteColor" />
Try this..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f6faf7"
android:gravity="center"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativelayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="275dp"
android:layout_toStartOf="#id/relativelayout1"
android:adjustViewBounds="true">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativelayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<EditText
android:id="#+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="#+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/login_password"
android:text="REGISTER" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:text="Don't have an Account? Create one!" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
And your output like this..
please help me.
im developing song book application.
but i encounter some problem that i dont know how to do.
please see picture below.
i want the background of my relative to match parent height.
here is my xml code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingLeft="10dip" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/relativeLayout1"
android:layout_marginRight="160dp"
android:paddingRight="5dip">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="#+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold" />
</FrameLayout>
<FrameLayout
android:id="#+id/framelayout2"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/volume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_gravity="right|top" />
<TextView
android:id="#+id/artist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_gravity="left|top" />
</FrameLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#eeeeee"
android:layout_alignParentTop="true"
android:id="#+id/relativeLayout2"
android:layout_toStartOf="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/mic"
android:layout_gravity="left|top" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/heart"
android:layout_gravity="right|top" />
</FrameLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#cccccc"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:id="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp">
<TextView
android:id="#+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal|top" />
</FrameLayout>
</RelativeLayout>
</RelativeLayout>
i want this RelativeLayout to match the parent height
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#cccccc"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:id="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp">
<TextView
android:id="#+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal|top" />
</FrameLayout>
</RelativeLayout>
CODE UPDATE AND IMAGE
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingLeft="10dip" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="80"
android:id="#+id/relativeLayout1"
android:paddingRight="5dip">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" android:layout_weight="80">
<FrameLayout
android:id="#+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold" />
</FrameLayout>
<FrameLayout
android:id="#+id/framelayout2"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/volume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_gravity="right|top" />
<TextView
android:id="#+id/artist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_gravity="left|top" />
</FrameLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_weight="10"
android:background="#eeeeee"
android:layout_alignParentTop="true"
android:id="#+id/relativeLayout2"
android:layout_toStartOf="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_weight="10">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/mic"
android:layout_gravity="left|top" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/heart"
android:layout_gravity="right|top" />
</FrameLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_weight="10"
android:background="#cccccc"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:id="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_weight="10">
<TextView
android:id="#+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal|top" />
</FrameLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingLeft="10dip" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/relativeLayout1"
android:layout_marginRight="160dp"
android:paddingRight="5dip">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="#+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold" />
</FrameLayout>
<FrameLayout
android:id="#+id/framelayout2"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/volume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_gravity="right|top" />
<TextView
android:id="#+id/artist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_gravity="left|top" />
</FrameLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#eeeeee"
android:layout_alignParentTop="true"
android:id="#+id/relativeLayout2"
android:layout_toStartOf="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/camera"
android:layout_gravity="left|top" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/camera"
android:layout_gravity="right|top" />
</FrameLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#cccccc"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:id="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp">
<TextView
android:id="#+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal|top" />
</FrameLayout>
</RelativeLayout>
Try this:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#cccccc"
android:layout_alignParentRight="true"
android:id="#+id/relativeLayout3">
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp">
<TextView
android:id="#+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17dp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal|top" />
</FrameLayout>
</RelativeLayout>
I have RecyclerView and LinearLayout in CoordinatorLayout. For RecyclerView scroll is working fine but i want above content to scroll in the screen. Please guide what changes i need to do or anything im doing wrong please guide me.
my activity_article_polls.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="in.passionconnect.application.ArticlePolls">
<android.support.v7.widget.RecyclerView
android:id="#+id/landing_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="440dp"
android:clipToPadding="false"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_article_polls" />
</android.support.design.widget.CoordinatorLayout>
and my content_article_polls.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
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:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="in.passionconnect.application.ArticlePolls"
tools:showIn="#layout/activity_article_polls">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/landing_list"
android:orientation="vertical"
app:layout_scrollFlags="scroll|enterAlways">
<LinearLayout
android:id="#+id/layout_filters"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/colorPrimary"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="3">
<CheckBox
android:id="#+id/chk_date"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Newest"
android:textColor="#color/white" />
<CheckBox
android:id="#+id/chk_random"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Random"
android:textColor="#color/white" />
<CheckBox
android:id="#+id/chk_popular"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Popularity"
android:textColor="#color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/card_summary_read_more_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/card_background_gradient_overlay"
android:layout_width="match_parent"
android:layout_height="#dimen/landing_card_imageview_height"
android:adjustViewBounds="true"
android:background="#drawable/card_gradient_overlay"
android:scaleType="centerCrop" />
<TextView
android:id="#+id/article_poll_title"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="left|bottom"
android:padding="10dp"
android:text="Top 3 Highest Grossing Hollywood Movies"
android:textColor="#color/white"
android:textSize="14sp" />
</FrameLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="10dp">
<in.passionconnect.application.view.RoundedImageView
android:id="#+id/card_author_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:padding="12dp"
android:scaleType="centerCrop"
android:src="#drawable/lion" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp">
<TextView
android:id="#+id/article_author"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="8"
android:text="Prasanth"
android:textColor="#color/dark_gray"
android:textSize="15sp" />
<TextView
android:id="#+id/article_author_desn"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="developer at varchas technologies"
android:textColor="#color/dark_gray"
android:textSize="12sp" />
<TextView
android:id="#+id/article_date"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12th March 2016 06:09:06 PM"
android:textColor="#color/dark_gray"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/article_author_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/dark_gray"
android:visibility="invisible" />
<TextView
android:id="#+id/article_title_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/dark_gray"
android:visibility="invisible" />
</LinearLayout>
<TextView
android:id="#+id/txt_follow"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:background="#drawable/follow_border"
android:padding="10dp"
android:text="Follow"
android:textColor="#b7492b"
android:textSize="15sp" />
<TextView
android:id="#+id/txt_unfollow"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#drawable/follow_border"
android:padding="10dp"
android:text="Following"
android:textColor="#b7492b"
android:textSize="15sp"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="#+id/card_summary"
style="#style/roboregular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="2.5dp"
android:padding="10dp"
android:text="#string/card_summary"
android:textColor="#color/dark_gray"
android:textSize="16sp"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/landing_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
I have tried like also, only my recyclerview scroll. I want scroll the whole screen along with the recyclerview.
Thanks in Advance
Atlast i tried and fixed the scrolling problem. I have referred This link
Just setting the height to my Recyclerview android:minHeight="840dp"
content_article_polls.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
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:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="in.passionconnect.application.ArticlePolls"
tools:showIn="#layout/activity_article_polls">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/landing_list"
android:orientation="vertical"
app:layout_scrollFlags="scroll|enterAlways">
<LinearLayout
android:id="#+id/layout_filters"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/colorPrimary"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="3">
<CheckBox
android:id="#+id/chk_date"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Newest"
android:textColor="#color/white" />
<CheckBox
android:id="#+id/chk_random"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Random"
android:textColor="#color/white" />
<CheckBox
android:id="#+id/chk_popular"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Popularity"
android:textColor="#color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/card_summary_read_more_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/card_background_gradient_overlay"
android:layout_width="match_parent"
android:layout_height="#dimen/landing_card_imageview_height"
android:adjustViewBounds="true"
android:background="#drawable/card_gradient_overlay"
android:scaleType="centerCrop" />
<TextView
android:id="#+id/article_poll_title"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="left|bottom"
android:padding="10dp"
android:text="Top 3 Highest Grossing Hollywood Movies"
android:textColor="#color/white"
android:textSize="14sp" />
</FrameLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="10dp">
<in.passionconnect.application.view.RoundedImageView
android:id="#+id/card_author_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:padding="12dp"
android:scaleType="centerCrop"
android:src="#drawable/lion" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp">
<TextView
android:id="#+id/article_author"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="8"
android:text="Prasanth"
android:textColor="#color/dark_gray"
android:textSize="15sp" />
<TextView
android:id="#+id/article_author_desn"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="developer at varchas technologies"
android:textColor="#color/dark_gray"
android:textSize="12sp" />
<TextView
android:id="#+id/article_date"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12th March 2016 06:09:06 PM"
android:textColor="#color/dark_gray"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/article_author_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/dark_gray"
android:visibility="invisible" />
<TextView
android:id="#+id/article_title_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/dark_gray"
android:visibility="invisible" />
</LinearLayout>
<TextView
android:id="#+id/txt_follow"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:background="#drawable/follow_border"
android:padding="10dp"
android:text="Follow"
android:textColor="#b7492b"
android:textSize="15sp" />
<TextView
android:id="#+id/txt_unfollow"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#drawable/follow_border"
android:padding="10dp"
android:text="Following"
android:textColor="#b7492b"
android:textSize="15sp"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="#+id/card_summary"
style="#style/roboregular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="2.5dp"
android:padding="10dp"
android:text="#string/card_summary"
android:textColor="#color/dark_gray"
android:textSize="16sp"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/landing_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:minHeight="840dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="in.passionconnect.application.ArticlePolls">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_article_polls" />
</android.support.design.widget.CoordinatorLayout>
And your other layout to be included should look as below:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView 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"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="in.passionconnect.application.ArticlePolls"
tools:showIn="#layout/activity_scrolling">
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/landing_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="440dp"
android:clipToPadding="false"/>
<LinearLayout
android:layout_below="#+id/landing_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|enterAlways">
<LinearLayout
android:id="#+id/layout_filters"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/colorPrimary"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="3">
<CheckBox
android:id="#+id/chk_date"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Newest"
android:textColor="#color/white" />
<CheckBox
android:id="#+id/chk_random"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Random"
android:textColor="#color/white" />
<CheckBox
android:id="#+id/chk_popular"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#ffffff"
android:text="Popularity"
android:textColor="#color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/card_summary_read_more_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/card_background_gradient_overlay"
android:layout_width="match_parent"
android:layout_height="#dimen/landing_card_imageview_height"
android:adjustViewBounds="true"
android:background="#drawable/card_gradient_overlay"
android:scaleType="centerCrop" />
<TextView
android:id="#+id/article_poll_title"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="left|bottom"
android:padding="10dp"
android:text="Top 3 Highest Grossing Hollywood Movies"
android:textColor="#color/white"
android:textSize="14sp" />
</FrameLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="10dp">
<in.passionconnect.application.view.RoundedImageView
android:id="#+id/card_author_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:padding="12dp"
android:scaleType="centerCrop"
android:src="#drawable/lion" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp">
<TextView
android:id="#+id/article_author"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="8"
android:text="Author name"
android:textColor="#color/dark_gray"
android:textSize="15sp" />
<TextView
android:id="#+id/article_author_desn"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="author"
android:textColor="#color/dark_gray"
android:textSize="12sp" />
<TextView
android:id="#+id/article_date"
style="#style/roboregular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12th March 2016 06:09:06 PM"
android:textColor="#color/dark_gray"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/txt_follow"
style="#style/robobold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:background="#drawable/follow_border"
android:padding="10dp"
android:text="Follow"
android:textColor="#b7492b"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
I am unable to place a layout at the bottom after a scroll view. Please help.
This is my code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal" />
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
android:gravity="bottom">
<LinearLayout
android:id="#+id/linear_call"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector">
<ImageView
android:id="#+id/btn_phone_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/call_us_tab"/>
<TextView
android:id="#+id/call"
android:textColor="#android:color/white"
android:text="Call Us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_message"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/message_tab"
/>
<TextView
android:id="#+id/msg"
android:textColor="#android:color/white"
android:text="Message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:background="#drawable/list_selector"
android:padding="8dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/share_tab"/>
<TextView
android:id="#+id/share"
android:textColor="#android:color/white"
android:text="Share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:padding="5dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none"
android:layout_above="#+id/bottom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/tv_name_detail_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/tv_map"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Map"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"/>
</RelativeLayout>
<TextView
android:id="#+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RatingBar
android:layout_marginTop="2dp"
android:id="#+id/rating_bar_pro_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
style="#style/foodRatingBar"/>
<TextView
android:id="#+id/tv_nearby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" />
<TextView
android:layout_marginTop="5dp"
android:id="#+id/tv_specialization"
android:text="Specialization: "
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ListView
android:id="#+id/list_specialization"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:layout_marginTop="5dp"
android:id="#+id/tv_education"
android:text="Education:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ListView
android:id="#+id/list_education"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:id="#+id/tv_experiences"
android:layout_marginTop="5dp"
android:text="Experiences:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ListView
android:id="#+id/list_experience"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<!-- The navigation drawer -->
<ListView android:id="#+id/left_drawer"
android:layout_width="260dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#5488B8"
android:dividerHeight="1dp"
android:background="#00427F"
android:listSelector="#drawable/list_selector"
/>
</android.support.v4.widget.DrawerLayout>
Try like this, this will fix your problem.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottom"
android:layout_below="#+id/my_recycler_view"
android:fadingEdgeLength="0dp"
android:fillViewport="true"
android:overScrollMode="never"
android:padding="5dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="bottom"
android:orientation="horizontal">
</LinearLayout>
</RelativeLayout>
Use root layout as RelativeLayout and the view you want to align bottom that's add this line:
android:layout_alignParentBottom="true"
This will solve your issue.
Try this and give your scroll view any variable size rather than wrap_content
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:padding="5dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/tv_name_detail_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"
/>
<TextView
android:id="#+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RatingBar
android:layout_marginTop="2dp"
android:id="#+id/rating_bar_pro_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
style="#style/foodRatingBar"
/>
<TextView
android:id="#+id/tv_nearby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_marginTop="5dp"
android:id="#+id/tv_specialization"
android:text="Specialization: "
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_specialization"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:layout_marginTop="5dp"
android:id="#+id/tv_education"
android:text="Education:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_education"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:id="#+id/tv_experiences"
android:layout_marginTop="5dp"
android:text="Experiences:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_experience"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
>
<LinearLayout
android:id="#+id/linear_call"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector">
<ImageView
android:id="#+id/btn_phone_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/call_us_tab"/>
<TextView
android:id="#+id/call"
android:textColor="#android:color/white"
android:text="Call Us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_message"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/message_tab"
/>
<TextView
android:id="#+id/msg"
android:textColor="#android:color/white"
android:text="Message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:background="#drawable/list_selector"
android:padding="8dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/share_tab"/>
<TextView
android:id="#+id/share"
android:textColor="#android:color/white"
android:text="Share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
You need to use RelativeLayout instead of LinearLayout at parent and then you can place items up and down to each other like
which view you want below to another view you can use this
android:layout_below="#+id/yourview"
and for view you want above to other you can use this
android:layout_above="#+id/yourview"
here is a sample
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView">
<!-- some stuff in here -->
</LinearLayout>
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
Hope it helps
try this hopefully this is what you wanted
<?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="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal"
/>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="220dp"
android:fadingEdgeLength="0dp"
android:padding="5dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/tv_name_detail_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:text="Name"/>
<TextView
android:id="#+id/tv_address"
android:text="address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RatingBar
android:layout_marginTop="2dp"
android:id="#+id/rating_bar_pro_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
/>
<TextView
android:id="#+id/tv_nearby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_marginTop="5dp"
android:id="#+id/tv_specialization"
android:text="Specialization: "
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_specialization"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:layout_marginTop="5dp"
android:id="#+id/tv_education"
android:text="Education:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_education"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:id="#+id/tv_experiences"
android:layout_marginTop="5dp"
android:text="Experiences:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_experience"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5"
>
<LinearLayout
android:layout_weight="2"
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:weightSum="3"
>
<LinearLayout
android:id="#+id/linear_call"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:weightSum="3"
android:background="#000000">
<ImageView
android:id="#+id/btn_phone_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/name_top"
android:layout_weight="2"
/>
<TextView
android:id="#+id/call"
android:textColor="#android:color/white"
android:text="Call Us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_message"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:weightSum="2"
android:layout_weight="1"
android:background="#000000"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/name_top"
android:layout_weight="1"
/>
<TextView
android:id="#+id/msg"
android:textColor="#android:color/white"
android:text="Message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:background="#000000"
android:weightSum="2"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/name_top"
android:layout_weight="1"
/>
<TextView
android:id="#+id/share"
android:textColor="#android:color/white"
android:text="Share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:layout_weight="3"
android:id="#+id/left_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#5488B8"
android:dividerHeight="1dp"
android:background="#00427F"
android:listSelector="#898989"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Please update version of a recyclerview library in gradle file :
compile 'com.android.support:recyclerview-v7:23.2.1'
It should solve your issue.
Due to this issue, wrap_content not used to work on recyclerview before this version.