1

My layout has a ScrollView and a fixed bottom bar.

Once I add bottom bar with two buttons, ScrollView items are not visible.

I tried changing parent layout but it is not working.

Please find the code 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="#fff"> <include android:id="@+id/toolbar" layout="@layout/toolbar" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:orientation="horizontal" android:weightSum="2" > <Button android:id="@+id/bottombar1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/colorPrimary" android:text="Add to Cart " android:textColor="@color/White" android:textStyle="bold" /> <Button android:id="@+id/bottombar2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/colorPrimary" android:text="Buy Now " android:textColor="@color/White" android:textStyle="bold" /> </LinearLayout> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="0dp" android:layout_below="@id/toolbar" android:background="#fff"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff" android:orientation="vertical" > <TextView android:id="@+id/text_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="20dp" android:text="Name" android:textColor="#000" android:textSize="20dp" /> <ImageView android:id="@+id/image_full" android:layout_width="220dp" android:layout_height="300dp" android:layout_gravity="center" android:padding="20dp" android:scaleType="fitXY" /> <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="none"> <LinearLayout android:id="@+id/imageall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"></LinearLayout> </HorizontalScrollView> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/price_full" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:padding="20dp" android:text="Price" android:textColor="#000" android:textSize="20dp" android:textStyle="bold" /> </RelativeLayout> <TextView android:id="@+id/text_des" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="20dp" android:text="Full details" android:textColor="#000" android:textSize="20dp" /> </LinearLayout> </ScrollView> 

Any help would be really greatfull.

Thanks.

2 Answers 2

1

In Scroll view give

 android:layout_above="<Id of your linear layout that contains two buttons>" 

Only specifying below toolbar will make scroll view stretch till bottom of screen. Also make sure that linear layout of buttons does not stretch full screen.

Sign up to request clarification or add additional context in comments.

Comments

1

Like this:

<?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="#fff"> <include android:id="@+id/toolbar" layout="@layout/toolbar" /> <LinearLayout android:id="@+id/btm_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:orientation="horizontal" android:weightSum="2" > <Button android:id="@+id/bottombar1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/colorPrimary" android:text="Add to Cart " android:textColor="@color/White" android:textStyle="bold" /> <Button android:id="@+id/bottombar2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/colorPrimary" android:text="Buy Now " android:textColor="@color/White" android:textStyle="bold" /> </LinearLayout> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/btm_bar_layout" android:layout_below="@id/toolbar" android:background="#fff"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff" android:orientation="vertical" > <TextView android:id="@+id/text_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="20dp" android:text="Name" android:textColor="#000" android:textSize="20dp" /> <ImageView android:id="@+id/image_full" android:layout_width="220dp" android:layout_height="300dp" android:layout_gravity="center" android:padding="20dp" android:scaleType="fitXY" /> <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="none"> <LinearLayout android:id="@+id/imageall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"></LinearLayout> </HorizontalScrollView> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/price_full" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:padding="20dp" android:text="Price" android:textColor="#000" android:textSize="20dp" android:textStyle="bold" /> </RelativeLayout> <TextView android:id="@+id/text_des" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="20dp" android:text="Full details" android:textColor="#000" android:textSize="20dp" /> </LinearLayout> </ScrollView> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.