I have a floating action button over a listview, but I can't click on the button when the list fills up so that the button and the list overlap. In that situation only the list item is clickable. How do I rectify this issue? Thanks in advance. My xml code is below.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
card_view:cardCornerRadius="1dp"
card_view:cardElevation="5dp">
<RelativeLayout
android:id="#+id/layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/frameLayout"
android:layout_centerHorizontal="true"
android:layout_gravity="bottom"
android:background="#000000"
android:orientation="vertical"
android:padding="1.5dp"
android:weightSum="1">
<TextView
android:id="#+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="#660033"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/primary_text_dark" />
<RelativeLayout
android:id="#+id/frameLayout"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="29dp"
android:background="#android:color/darker_gray"
android:padding="2dp">
<TextView
android:id="#+id/txtLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/dispLoc"
android:layout_gravity="left|top"
android:text="[Location]"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/txtDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/dispDesc"
android:layout_gravity="left|center_vertical"
android:layout_marginTop="1dp"
android:text="[Description]"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/dispLoc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="#string/loc"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/dispDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtLocation"
android:layout_gravity="left|center_vertical"
android:layout_marginTop="17dp"
android:text="#string/desc"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/dispContact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtDesc"
android:layout_marginTop="25dp"
android:text="#string/contact"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/txtContact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/dispContact"
android:layout_toEndOf="#+id/dispLoc"
android:autoLink="email"
android:text="[ContactInfo]"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/From"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/dispContact"
android:layout_marginTop="16dp"
android:text="#string/from"
android:textColor="#android:color/primary_text_light" />
<TextView
android:id="#+id/txtStartDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/From"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#+id/From"
android:text="[Start Date]"
android:textColor="#android:color/secondary_text_light" />
<TextView
android:id="#+id/To"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtStartDate"
android:text="#string/to"
android:textColor="#android:color/primary_text_light" />
<TextView
android:id="#+id/txtEndDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/txtStartDate"
android:layout_alignTop="#+id/To"
android:text="[End Date]"
android:textColor="#android:color/secondary_text_light" />
<Button
android:id="#+id/attend_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:text="Attend" />
<Button
android:id="#+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignStart="#+id/txtContact"
android:text="Cancel" />
</RelativeLayout>
<TextView
android:id="#+id/txtType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/txtTitle"
android:layout_alignEnd="#+id/txtTitle"
android:text="Type"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/primary_text_dark" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/peopleAttending"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/card_view"
android:background="#660033"
android:text="#string/people_attending"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/primary_text_dark" />
<org.lucasr.twowayview.TwoWayView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/lvItems"
style="#style/TwoWayView"
android:layout_width="match_parent"
android:layout_height="37dp"
android:layout_below="#+id/peopleAttending"
android:drawSelectorOnTop="false"
tools:context=".DetailedEventActivity" />
<com.software.shell.fab.ActionButton xmlns:fab="http://schemas.android.com/apk/res-auto"
android:id="#+id/action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="#dimen/fab_margin"
android:layout_marginEnd="#dimen/fab_margin"
fab:button_color="#color/fab_material_red_500"
fab:button_colorPressed="#color/fab_material_red_900"
fab:hide_animation="#anim/fab_roll_to_down"
fab:image="#drawable/fab_plus_icon"
fab:image_size="24dp"
fab:shadow_color="#757575"
fab:shadow_radius="1.0dp"
fab:shadow_xOffset="0.5dp"
fab:shadow_yOffset="1.0dp"
fab:show_animation="#anim/fab_roll_from_down"
fab:stroke_color="#color/fab_material_blue_grey_500"
fab:stroke_width="1.0dp"
fab:type="DEFAULT"
android:clickable="true"/>
<ListView
android:id="#+id/commentsList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/lvItems"
android:layout_marginTop="0dp"
/>
Move your FAB to the bottom of the XML (below the ListView).
Related
I am trying to create a scrollable list with ratingbars and textviews.
However I am unable to get them to align correctly. I would like even spacing between all textviews and rating bars..
I have tried to use the layout_below but this does not produce what I would like, I have also tried dragging, but this also does not create the wanted effect.
Any help would be appreciated :)
<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/colorPrimaryDark"
tools:context="uk.co.neverendingsport.neverendingsport.LoginActivity">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Continue"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="13dp"
android:id="#+id/button" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Sports"
android:textSize="30sp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="#+id/textView4"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/footballTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Football"
android:textSize="30sp"
android:layout_above="#+id/cyclingRatingBar"
android:layout_alignParentStart="true" />
<RatingBar
android:id="#+id/footballRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/cyclingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cycling"
android:textSize="30sp"
android:layout_above="#+id/badmintonTextView"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp" />
<RatingBar
android:id="#+id/cyclingRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/footballRatingBar"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/badmintonTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Badminton"
android:textSize="30sp"
android:layout_below="#+id/cyclingRatingBar"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/badmintonRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/runningTextView"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/runningTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Running"
android:textSize="30sp"
android:layout_below="#+id/badmintonTextView"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/runningRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/badmintonRatingBar"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/swimmingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Swimming"
android:textSize="30sp"
android:layout_below="#+id/runningTextView"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/swimmingRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/runningRatingBar"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/golfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Golf"
android:textSize="30sp"
android:layout_below="#+id/swimmingTextView"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/golfRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/swimmingRatingBar"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
Image of current layout
Here is the answer that works fine for me
<?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">
<TextView
android:id="#+id/textView2"
style="#style/Base.TextAppearance.AppCompat.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="Select Sports" />
<TextView
android:id="#+id/textView6"
style="#style/Base.TextAppearance.AppCompat.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/ratingBar"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="17dp"
android:layout_toLeftOf="#+id/ratingBar"
android:layout_toStartOf="#+id/ratingBar"
android:text="Football" />
<RatingBar
android:id="#+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView2" />
<RatingBar
android:id="#+id/ratingBar2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/ratingBar" />
<RatingBar
android:id="#+id/ratingBar3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/ratingBar2"
android:layout_alignStart="#+id/ratingBar2"
android:layout_below="#+id/ratingBar2" />
<RatingBar
android:id="#+id/ratingBar4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/ratingBar3"
android:layout_alignStart="#+id/ratingBar3"
android:layout_below="#+id/ratingBar3" />
<TextView
android:id="#+id/textView7"
style="#style/Base.TextAppearance.AppCompat.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/ratingBar3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="17dp"
android:layout_toLeftOf="#+id/textView2"
android:text="Cycling" />
<TextView
android:id="#+id/textView8"
style="#style/Base.TextAppearance.AppCompat.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/ratingBar4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="14dp"
android:layout_toLeftOf="#+id/ratingBar3"
android:text="Badminton" />
<TextView
android:id="#+id/textView9"
style="#style/Base.TextAppearance.AppCompat.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/ratingBar4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="16dp"
android:layout_toLeftOf="#+id/ratingBar4"
android:text="Running" />
</RelativeLayout>]
final output
First of all you need to add rating bar to parent layout and later textview to the parent layout
Try this
<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/colorPrimaryDark"
tools:context="uk.co.neverendingsport.neverendingsport.LoginActivity">
<Button
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="13dp"
android:text="Continue" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="Select Sports"
android:textSize="30sp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="#+id/textView4">
<RelativeLayout
android:id="#+id/relativeFootball"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/footballTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Football"
android:textSize="30sp" />
<RatingBar
android:id="#+id/footballRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeCycle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeFootball">
<TextView
android:id="#+id/cyclingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Cycling"
android:textSize="30sp" />
<RatingBar
android:id="#+id/cyclingRatingBar"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeBadminton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeCycle">
<TextView
android:id="#+id/badmintonTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Badminton"
android:textSize="30sp" />
<RatingBar
android:id="#+id/badmintonRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeRunning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeBadminton">
<TextView
android:id="#+id/runningTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Running"
android:textSize="30sp" />
<RatingBar
android:id="#+id/runningRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeSwimming"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeRunning">
<TextView
android:id="#+id/swimmingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:text="Swimming"
android:textSize="30sp" />
<RatingBar
android:id="#+id/swimmingRatingBar"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeGolf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeSwimming">
<TextView
android:id="#+id/golfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Golf"
android:textSize="30sp" />
<RatingBar
android:id="#+id/golfRatingBar"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimaryDark"
>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Continue"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="13dp"
android:id="#+id/button" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Sports"
android:textSize="28sp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView4"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/footballTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Football"
android:textSize="28sp"
android:layout_weight="1"
android:layout_above="#+id/cyclingRatingBar"
/>
<RatingBar
android:id="#+id/footballRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/cyclingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cycling"
android:textSize="28sp"
android:layout_weight="1"
android:layout_above="#+id/badmintonTextView"
android:layout_marginBottom="10dp" />
<RatingBar
android:id="#+id/cyclingRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/footballRatingBar"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/badmintonTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Badminton"
android:textSize="28sp"
android:layout_below="#+id/cyclingRatingBar"
android:layout_weight="1"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/badmintonRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/runningTextView"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/runningTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Running"
android:textSize="28sp"
android:layout_weight="1"
android:layout_below="#+id/badmintonTextView"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/runningRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/badmintonRatingBar"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/swimmingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Swimming"
android:textSize="28sp"
android:layout_weight="1"
android:layout_below="#+id/runningTextView"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/swimmingRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/runningRatingBar"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/golfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Golf"
android:textSize="28sp"
android:layout_weight="1"
android:layout_below="#+id/swimmingTextView"
android:layout_marginBottom="10dp"/>
<RatingBar
android:id="#+id/golfRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/swimmingRatingBar"
>
</RatingBar>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
im trying to put a scroll view inside a frame layout. My scroll view is not scrolling all the way to bottom. this is my xml code. It is working when i give a padding to scroll view. but i need a better answer. because giving a padding will make a white margin below my application. Thank you!
<FrameLayout 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="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
// this is your first layout to put the big image
// use src or backgroud image as per requirement
<LinearLayout
android:background="#drawable/bg"
android:layout_width="match_parent"
android:layout_height="180dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/imageView"
android:background="#drawable/overly" />
</LinearLayout>
// this is your bottom layout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffc9c9c9"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout"
android:layout_marginTop="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Anna Huffmunster"
android:id="#+id/textView2"
android:textStyle="bold"
android:textSize="20dp"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:paddingTop="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Colombo Sri lanka"
android:id="#+id/txt_location"
android:textSize="15dp"
android:gravity="center"
android:textStyle="italic"
android:textColor="#696969"
android:paddingBottom="7dp"
android:paddingTop="5dp"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/scrollView"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="#+id/relativeLayout"
android:layout_marginTop="12dp"
android:id="#+id/relativeLayout2">
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/imageButton"
android:background="#drawable/call_button"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/imageButton2"
android:background="#drawable/chat_button"
android:layout_alignParentTop="true"
android:layout_toStartOf="#+id/imageButton"
android:layout_marginRight="30dp" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/imageButton3"
android:background="#drawable/location_button"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/imageButton"
android:layout_marginLeft="30dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativeLayout2"
android:layout_alignParentStart="true"
android:layout_marginTop="12dp"
android:id="#+id/relativeLayout3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="“Live each day as if your life had just begun.” "
android:id="#+id/txt_status"
android:textColor="#ffd9162d"
android:textSize="12dp"
android:textStyle="italic"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativeLayout3"
android:layout_alignParentStart="true">
<TextView
android:text="Birthday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:textSize="12sp"
android:layout_marginStart="75dp"
android:layout_marginTop="23dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:textColor="#000" />
<TextView
android:text="19 MAR 1992"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView4"
android:inputType="date"
android:layout_marginEnd="79dp"
android:textSize="12sp"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_alignParentEnd="true" />
<TextView
android:text="Profession"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView5"
android:layout_below="#+id/textView3"
android:layout_alignStart="#+id/textView3"
android:layout_marginTop="20dp"
android:textColor="#000"
android:textSize="12sp" />
<TextView
android:text="Software Engineer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView6"
android:textSize="12sp"
android:maxWidth="20dp"
android:layout_alignTop="#+id/textView5"
android:layout_alignStart="#+id/textView4"
android:layout_alignEnd="#+id/textView4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true">
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView8"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView11"
android:layout_below="#+id/textView8"
android:layout_alignParentStart="true" />
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView9"
android:layout_below="#+id/textView11"
android:layout_alignParentStart="true" />
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView10"
android:layout_below="#+id/textView9"
android:layout_alignParentStart="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
// This is the imageview which overlay the first LinearLayout
<ImageView
android:layout_width="122dp"
android:layout_height="122dp"
android:src="#drawable/circle_profile_pic"
android:adjustViewBounds="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
android:background="#drawable/stroke"/>
i have got an activity that has an image at the top of the screen. everything below the Image needs to be scrollable. see picture below:
I have tries placing the ScrollView Layout below the picture but i keep on getting an error saying "Unexpected end of statement" but the opening tag for ScrollView is correct so i am going crazy!
here is my XML code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<RelativeLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.rkmsolutions.restaurantapp.MainActivity">
<ImageView
android:id="#+id/sapori_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:src="#drawable/sapori_logo_cropped"
tools:ignore="ContentDescription" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/sapori_banner">
<ImageView
android:id="#+id/olivesAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="#drawable/olives512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/oliveAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/olivesAppetiserImage"
android:layout_toRightOf="#+id/olivesAppetiserImage"
android:gravity="start"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/olivesAppetizerTitleTxtView"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/oliveAppetisersBodyDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/olivesAppetiserImage"
android:layout_below="#+id/oliveAppetiserTitle"
android:layout_toEndOf="#+id/olivesAppetiserImage"
android:layout_toRightOf="#+id/olivesAppetiserImage"
android:gravity="center_vertical"
android:text="#string/oliveAppetizerDescription" />
<TextView
android:id="#+id/oliveAppetiserPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/oliveAppetisersBodyDescription"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/oliveAppetiserTitle"
android:layout_toRightOf="#+id/oliveAppetisersBodyDescription"
android:gravity="center"
android:text="#string/oliveAppetiserPriceText" />
<ImageView
android:id="#+id/bruschettaAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/olivesAppetiserImage"
android:scaleType="centerCrop"
android:src="#drawable/bruschetta512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/bruschettaAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/bruschettaAppetiserImage"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/bruschettaAppetiserTitle"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/bruschettaAppetisersBodyDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/bruschettaAppetiserImage"
android:layout_below="#+id/bruschettaAppetiserTitle"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:gravity="center_vertical"
android:text="#string/bruschettaAppetiserDescription" />
<TextView
android:id="#+id/bruschettaAppetiserPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/bruschettaAppetiserImage"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/bruschettaAppetisersBodyDescription"
android:layout_toEndOf="#+id/bruschettaAppetisersBodyDescription"
android:layout_toRightOf="#+id/bruschettaAppetisersBodyDescription"
android:gravity="center_vertical"
android:text="#string/bruschettaAppetiserPriceText"
android:textAlignment="center" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="#drawable/vegetarian_bruschetta512x512"
tools:ignore="ContentDescription"
android:id="#+id/veggieBruschettaAppetiserImage"
android:layout_below="#+id/bruschettaAppetiserImage"/>
<TextView
android:id="#+id/veggieBruschettaAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/veggieBruschettaAppetiserImage"
android:layout_toEndOf="#+id/veggieBruschettaAppetiserImage"
android:layout_toRightOf="#+id/veggieBruschettaAppetiserImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/veggieBruschettaTitle"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/veggieBruschettaDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/veggieBruschettaAppetiserImage"
android:layout_below="#+id/veggieBruschettaAppetiserTitle"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:gravity="center_vertical"
android:text="Toasted bread with grilled vegetarian antipasti" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/veggieBruschettaPrice"
android:gravity="center"
android:textAlignment="center"
android:text="#string/veggieBruschettaPriceString"
android:layout_toRightOf="#id/veggieBruschettaDescription"
android:layout_toEndOf="#+id/veggieBruschettaDescription"
android:layout_alignTop="#+id/veggieBruschettaDescription"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignBottom="#+id/veggieBruschettaAppetiserImage"/>
<ImageView
android:id="#+id/paneAglioImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:layout_below="#+id/veggieBruschettaAppetiserImage"
android:src="#drawable/garlic_bread_pizza512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/paneAglioTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/paneAglioImage"
android:layout_toEndOf="#+id/paneAglioImage"
android:layout_toRightOf="#+id/paneAglioImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/paneAglioTitleString"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/paneAglioDescription"
android:gravity="center_vertical"
android:text="#string/paneAglioDescriptionString"
android:layout_toEndOf="#+id/paneAglioImage"
android:layout_toRightOf="#+id/paneAglioImage"
android:layout_below="#+id/paneAglioTitle"
android:layout_alignBottom="#+id/paneAglioImage"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:textAlignment="center"
android:layout_alignBottom="#+id/paneAglioImage"
android:layout_toRightOf="#+id/paneAglioDescription"
android:layout_toEndOf="#+id/paneAglioDescription"
android:text="#string/paneAglioPriceString"
android:layout_alignTop="#+id/paneAglioDescription"/>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
it will be a simple solution but i just dont know what else to try!
thanks SO!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.rkmsolutions.restaurantapp.MainActivity">
<ImageView
android:id="#+id/sapori_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:src="#drawable/sapori_logo_cropped"
tools:ignore="ContentDescription" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/sapori_banner">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="#+id/olivesAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="#drawable/olives512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/oliveAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/olivesAppetiserImage"
android:layout_toRightOf="#+id/olivesAppetiserImage"
android:gravity="start"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/olivesAppetizerTitleTxtView"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/oliveAppetisersBodyDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/olivesAppetiserImage"
android:layout_below="#+id/oliveAppetiserTitle"
android:layout_toEndOf="#+id/olivesAppetiserImage"
android:layout_toRightOf="#+id/olivesAppetiserImage"
android:gravity="center_vertical"
android:text="#string/oliveAppetizerDescription" />
<TextView
android:id="#+id/oliveAppetiserPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/oliveAppetisersBodyDescription"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/oliveAppetiserTitle"
android:layout_toRightOf="#+id/oliveAppetisersBodyDescription"
android:gravity="center"
android:text="#string/oliveAppetiserPriceText" />
<ImageView
android:id="#+id/bruschettaAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/olivesAppetiserImage"
android:scaleType="centerCrop"
android:src="#drawable/bruschetta512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/bruschettaAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/bruschettaAppetiserImage"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/bruschettaAppetiserTitle"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/bruschettaAppetisersBodyDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/bruschettaAppetiserImage"
android:layout_below="#+id/bruschettaAppetiserTitle"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:gravity="center_vertical"
android:text="#string/bruschettaAppetiserDescription" />
<TextView
android:id="#+id/bruschettaAppetiserPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/bruschettaAppetiserImage"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/bruschettaAppetisersBodyDescription"
android:layout_toEndOf="#+id/bruschettaAppetisersBodyDescription"
android:layout_toRightOf="#+id/bruschettaAppetisersBodyDescription"
android:gravity="center_vertical"
android:text="#string/bruschettaAppetiserPriceText"
android:textAlignment="center" />
<ImageView
android:id="#+id/veggieBruschettaAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/bruschettaAppetiserImage"
android:scaleType="centerCrop"
android:src="#drawable/vegetarian_bruschetta512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/veggieBruschettaAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/veggieBruschettaAppetiserImage"
android:layout_toEndOf="#+id/veggieBruschettaAppetiserImage"
android:layout_toRightOf="#+id/veggieBruschettaAppetiserImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/veggieBruschettaTitle"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/veggieBruschettaDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/veggieBruschettaAppetiserImage"
android:layout_below="#+id/veggieBruschettaAppetiserTitle"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:gravity="center_vertical"
android:text="Toasted bread with grilled vegetarian antipasti" />
<TextView
android:id="#+id/veggieBruschettaPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/veggieBruschettaAppetiserImage"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/veggieBruschettaDescription"
android:layout_toEndOf="#+id/veggieBruschettaDescription"
android:layout_toRightOf="#id/veggieBruschettaDescription"
android:gravity="center"
android:text="#string/veggieBruschettaPriceString"
android:textAlignment="center" />
<ImageView
android:id="#+id/paneAglioImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/veggieBruschettaAppetiserImage"
android:scaleType="centerCrop"
android:src="#drawable/garlic_bread_pizza512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/paneAglioTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/paneAglioImage"
android:layout_toEndOf="#+id/paneAglioImage"
android:layout_toRightOf="#+id/paneAglioImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/paneAglioTitleString"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/paneAglioDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/paneAglioImage"
android:layout_below="#+id/paneAglioTitle"
android:layout_toEndOf="#+id/paneAglioImage"
android:layout_toRightOf="#+id/paneAglioImage"
android:gravity="center_vertical"
android:text="#string/paneAglioDescriptionString" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/paneAglioImage"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/paneAglioDescription"
android:layout_toEndOf="#+id/paneAglioDescription"
android:layout_toRightOf="#+id/paneAglioDescription"
android:gravity="center"
android:text="#string/paneAglioPriceString"
android:textAlignment="center" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
You should put your ImageView on a RelativeLayout with alignParentTop attribute. And you should define a container layout for your ImageView and TextViews.
Key point here ; ScrollView can only host one children. So you will add your container layout inside ScrollView and you will define layout_below attribute to make it below on your banner
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.rkmsolutions.restaurantapp.MainActivity">
<ImageView
android:id="#+id/sapori_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:src="#drawable/sapori_logo_cropped"
tools:ignore="ContentDescription" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/sapori_banner">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="#+id/olivesAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="#drawable/olives512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/oliveAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/olivesAppetiserImage"
android:layout_toRightOf="#+id/olivesAppetiserImage"
android:gravity="start"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/olivesAppetizerTitleTxtView"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/oliveAppetisersBodyDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/olivesAppetiserImage"
android:layout_below="#+id/oliveAppetiserTitle"
android:layout_toEndOf="#+id/olivesAppetiserImage"
android:layout_toRightOf="#+id/olivesAppetiserImage"
android:gravity="center_vertical"
android:text="#string/oliveAppetizerDescription" />
<TextView
android:id="#+id/oliveAppetiserPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/oliveAppetisersBodyDescription"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/oliveAppetiserTitle"
android:layout_toRightOf="#+id/oliveAppetisersBodyDescription"
android:gravity="center"
android:text="#string/oliveAppetiserPriceText" />
<ImageView
android:id="#+id/bruschettaAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/olivesAppetiserImage"
android:scaleType="centerCrop"
android:src="#drawable/bruschetta512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/bruschettaAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/bruschettaAppetiserImage"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/bruschettaAppetiserTitle"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/bruschettaAppetisersBodyDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/bruschettaAppetiserImage"
android:layout_below="#+id/bruschettaAppetiserTitle"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:gravity="center_vertical"
android:text="#string/bruschettaAppetiserDescription" />
<TextView
android:id="#+id/bruschettaAppetiserPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/bruschettaAppetiserImage"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/bruschettaAppetisersBodyDescription"
android:layout_toEndOf="#+id/bruschettaAppetisersBodyDescription"
android:layout_toRightOf="#+id/bruschettaAppetisersBodyDescription"
android:gravity="center_vertical"
android:text="#string/bruschettaAppetiserPriceText"
android:textAlignment="center" />
<ImageView
android:id="#+id/veggieBruschettaAppetiserImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/bruschettaAppetiserImage"
android:scaleType="centerCrop"
android:src="#drawable/vegetarian_bruschetta512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/veggieBruschettaAppetiserTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/veggieBruschettaAppetiserImage"
android:layout_toEndOf="#+id/veggieBruschettaAppetiserImage"
android:layout_toRightOf="#+id/veggieBruschettaAppetiserImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/veggieBruschettaTitle"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/veggieBruschettaDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/veggieBruschettaAppetiserImage"
android:layout_below="#+id/veggieBruschettaAppetiserTitle"
android:layout_toEndOf="#+id/bruschettaAppetiserImage"
android:layout_toRightOf="#+id/bruschettaAppetiserImage"
android:gravity="center_vertical"
android:text="Toasted bread with grilled vegetarian antipasti" />
<TextView
android:id="#+id/veggieBruschettaPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/veggieBruschettaAppetiserImage"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/veggieBruschettaDescription"
android:layout_toEndOf="#+id/veggieBruschettaDescription"
android:layout_toRightOf="#id/veggieBruschettaDescription"
android:gravity="center"
android:text="#string/veggieBruschettaPriceString"
android:textAlignment="center" />
<ImageView
android:id="#+id/paneAglioImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/veggieBruschettaAppetiserImage"
android:scaleType="centerCrop"
android:src="#drawable/garlic_bread_pizza512x512"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/paneAglioTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/paneAglioImage"
android:layout_toEndOf="#+id/paneAglioImage"
android:layout_toRightOf="#+id/paneAglioImage"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="#string/paneAglioTitleString"
android:textColor="#b71c1c"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/paneAglioDescription"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/paneAglioImage"
android:layout_below="#+id/paneAglioTitle"
android:layout_toEndOf="#+id/paneAglioImage"
android:layout_toRightOf="#+id/paneAglioImage"
android:gravity="center_vertical"
android:text="#string/paneAglioDescriptionString" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/paneAglioImage"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/paneAglioDescription"
android:layout_toEndOf="#+id/paneAglioDescription"
android:layout_toRightOf="#+id/paneAglioDescription"
android:gravity="center"
android:text="#string/paneAglioPriceString"
android:textAlignment="center" />
</RelativeLayout>
Try this way it will work
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:background="#689F38"
android:gravity="center"
android:layout_gravity="center">
<TextView
android:id="#+id/header_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/header_msg"
android:textColor="#FFFFFF"
android:textSize="25sp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:background="#689F38"
android:gravity="center"
android:layout_gravity="center">
<TextView
android:id="#+id/footer_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/footer_msg"
android:textColor="#FFFFFF"
android:gravity="center"
android:textSize="25sp"/>
</RelativeLayout>
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/footer"
android:layout_below="#+id/header"
android:fillViewport="true">
<LinearLayout
android:id="#+id/myLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:fillViewport="true">
<TextView
android:id="#+id/bodytext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/body_msg"
android:textColor="#F44336"
android:gravity="center"
android:textSize="25sp"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
For more check this
I have a three section relative layout for a login page.
The first section at the top of the page is 1 Imageview and 2 Textviews.
The second section is 6 RelativeLayouts containing 1 ImageView to the left and 1 TextView to the right.
The third section is a Button
The first four icons are ok on any device. The 5th and 6th are both getting resized or not showing up.
I would like to see all 6 but if 1 can't fit dont add it. How can I do this in a proper way.
Thanks - P.S Code is below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/newd_login_overlay"
android:orientation="vertical" >
<LinearLayout android:id="#+id/linLoginText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/login_logo_white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_one"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_two"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linLoginFeature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/btnLoginCreate"
android:layout_below="#+id/linLoginText"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginSecurity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_security"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginSecurity"
android:layout_toEndOf="#+id/imgLoginSecurity"
android:layout_centerVertical="true"
android:text="#string/newd_login_security"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginAntivirus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_antivirus"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginAntivirus"
android:layout_toEndOf="#+id/imgLoginAntivirus"
android:layout_centerVertical="true"
android:text="#string/newd_login_antivirus"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_phone_tracker"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginTracker"
android:layout_toEndOf="#+id/imgLoginTracker"
android:layout_centerVertical="true"
android:text="#string/newd_login_booster"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBackup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_backup"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBackup"
android:layout_toEndOf="#+id/imgLoginBackup"
android:layout_centerVertical="true"
android:text="#string/newd_login_backup"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_privacy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginPrivacy"
android:layout_toEndOf="#+id/imgLoginPrivacy"
android:layout_centerVertical="true"
android:text="#string/newd_login_privacy"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBooster"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_signal_booster"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBooster"
android:layout_toEndOf="#+id/imgLoginBooster"
android:layout_centerVertical="true"
android:text="#string/newd_login_tracker"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="#+id/btnLoginCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_alignParentBottom="true"
android:background="#drawable/newd_login_btn"
android:gravity="center"
android:text="#string/newd_login_btn_text"
android:textColor="#android:color/black" />
</RelativeLayout>
Use android:layout_weight
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/newd_login_overlay"
android:orientation="vertical" >
<LinearLayout android:id="#+id/linLoginText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/login_logo_white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_one"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_two"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linLoginFeature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="6"
android:layout_above="#+id/btnLoginCreate"
android:layout_below="#+id/linLoginText"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="vertical" >
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginSecurity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_security"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginSecurity"
android:layout_toEndOf="#+id/imgLoginSecurity"
android:layout_centerVertical="true"
android:text="#string/newd_login_security"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginAntivirus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_antivirus"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginAntivirus"
android:layout_toEndOf="#+id/imgLoginAntivirus"
android:layout_centerVertical="true"
android:text="#string/newd_login_antivirus"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_phone_tracker"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginTracker"
android:layout_toEndOf="#+id/imgLoginTracker"
android:layout_centerVertical="true"
android:text="#string/newd_login_booster"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBackup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_backup"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBackup"
android:layout_toEndOf="#+id/imgLoginBackup"
android:layout_centerVertical="true"
android:text="#string/newd_login_backup"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_privacy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginPrivacy"
android:layout_toEndOf="#+id/imgLoginPrivacy"
android:layout_centerVertical="true"
android:text="#string/newd_login_privacy"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBooster"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_signal_booster"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBooster"
android:layout_toEndOf="#+id/imgLoginBooster"
android:layout_centerVertical="true"
android:text="#string/newd_login_tracker"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="#+id/btnLoginCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_alignParentBottom="true"
android:background="#drawable/newd_login_btn"
android:gravity="center"
android:text="#string/newd_login_btn_text"
android:textColor="#android:color/black" />
</RelativeLayout>
I have a relative layout and i want it to make it scrollable, i made it too but the problem is it is scrollable even if it is not needed...
there are links that i refer but not worked in my case
how to make a relative layout scrollable when it has many children views?
RelativeLayout Scrollable
here is my layout
<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="match_parent" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/ab" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="135dp"
android:layout_height="135dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:src="#drawable/r" />
<TextView
android:id="#+id/rgpvtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="6dp"
android:text="RGPV Digest"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#5C9E70"
android:textSize="36sp" />
<TextView
android:id="#+id/compu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rgpvtext"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="25dp"
android:clickable="true"
android:text="Computer Science"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/calc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/compu"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Calculator"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/calc"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Interview Question"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/prog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/iv"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Programs"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/abo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/prog"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="About"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
</RelativeLayout>
</ScrollView>
<ListView
android:id="#+id/drawerlist"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#5B9D79"
android:paddingTop="6dp" />
</android.support.v4.widget.DrawerLayout>
You have to put all items in a root item like RelativeLayout, LinearLayout, etc. And if you want to use ScrollView as a root item, you have to declare one more item in it like RelativeLayout or LinearLayout then put all items in it.
I try to make it work as you want.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/ab">
<ImageView
android:id="#+id/imageView1"
android:layout_width="135dp"
android:layout_height="135dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:src="#drawable/r"/>
<TextView
android:id="#+id/rgpvtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="6dp"
android:text="RGPV Digest"
android:textColor="#drawable/texteff"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#5C9E70"
android:textSize="36sp" />
<TextView
android:id="#+id/compu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rgpvtext"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="25dp"
android:clickable="true"
android:textColor="#drawable/texteff"
android:text="Computer Science"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="24sp" />
<TextView
android:id="#+id/calc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/compu"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Calculator"
android:textColor="#drawable/texteff"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="24sp" />
<TextView
android:id="#+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/calc"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Interview Question"
android:textColor="#drawable/texteff"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="24sp" />
<TextView
android:id="#+id/prog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/iv"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Programs"
android:textColor="#drawable/texteff"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="24sp" />
<TextView
android:id="#+id/abo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/prog"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="About"
android:textColor="#drawable/texteff"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="24sp" />
<ListView
android:id="#+id/drawerlist"
android:layout_width="240dp"
android:fillViewport="true"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#5B9D79"
android:layout_below="#+id/abo"
android:paddingTop="6dp"/>
</RelativeLayout>
</ScrollView>
I made it scrollable....below code is working fine...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/ab" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="135dp"
android:layout_height="135dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:src="#drawable/rgpvicon" />
<TextView
android:id="#+id/rgpvtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="6dp"
android:clickable="true"
android:text="RGPV Digest"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#drawable/texteff"
android:textSize="36sp" />
<TextView
android:id="#+id/compu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rgpvtext"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="25dp"
android:clickable="true"
android:text="Computer Science"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/calc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/compu"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Calculator"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/calc"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Interview Question"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/prog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/iv"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Programs"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
<TextView
android:id="#+id/abo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/prog"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="About"
android:paddingBottom="20dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#drawable/texteff"
android:textSize="24sp" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
<ListView
android:id="#+id/drawerlist"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#5B9D79"
android:paddingTop="6dp" />