• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Using Scrollview i cannot get the PROCEED button placed at bottom

I have an issue using scroll view below are the cases

**CASE 1**

when i don't use scrollview i get the layout like [ this][1] and this is the layout i need.
Problem with this approach is when the device resolution is low 412 x 732 or below i cant see the whole content of the layout for that reason **i need scrollview**

**CASE 2**

if i use scroll view i get the view like this [this][1] and [this][2] this which is perfect and what i need for 412 x 732 or below but the problem occur when i see the layout in higher resolution 1080x1920 i get [this][3]

what is need is in **CASE 2** for higher resolution device the PROCEED button should touch the bottom with bottomPadding=20dp just like **CASE 1** image

I Really appreciate if someone give me suggestion to acquire the layout that work for both the devices having high and low resolution



[1]: https://i.stack.imgur.com/OIkFd.png
[2]: https://i.stack.imgur.com/JPRHe.png
[3]: https://i.stack.imgur.com/21OMe.png

**Layout**

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:eek:rientation="vertical"
android:background="@color/backgroundColor">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="USER AGREEMENT"
android:textColor="@android:color/white"
android:gravity="center"
android:id="@+id/userAgereement"
android:layout_marginTop="20dp"
android:textSize="@dimen/textSize"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Beijing Pinnacle Global &amp; Alex Edu\n(BPGE &amp; Alex Edu)"
android:textColor="@android:color/white"
android:gravity="center"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:id="@+id/belowHeadingText"
android:layout_marginTop="20dp"
android:textSize="@dimen/endSize"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Today's Date : 25th of August, 2019"
android:textColor="@android:color/white"
android:gravity="center"
android:layout_marginTop="20dp"
android:id="@+id/date"
android:textSize="@dimen/endSize"/>

<View
android:id="@+id/line"
android:layout_width="270dp"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:background="@android:color/white"
android:layout_height="1dp">

</View>

<ImageView
android:layout_marginTop="20dp"
android:layout_width="171dp"
android:layout_height="239dp"
android:layout_gravity="center"
android:clickable="true"
android:id="@+id/imageView"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/useragreemnet"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="You Are Going To Sign The User Agreement\nKindly, Provide Us Your Details"
android:textColor="@android:color/white"
android:gravity="center"
android:id="@+id/belowImageText"
android:layout_marginTop="20dp"
android:textSize="@dimen/endSize"/>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"

android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">

<android.support.v7.widget.CardView
android:layout_width="230dp"
android:layout_height="@dimen/buttonHeight"

android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:cardBackgroundColor="@color/functionalityColor"
app:cardCornerRadius="@dimen/cornerRadiusForButtons"

app:cardElevation="@dimen/elevation">

<Button
android:id="@+id/proceed"
android:layout_width="match_parent"
android:layout_height="@dimen/buttonHeight"
android:layout_marginBottom="20dp"
android:background="@android:color/transparent"
android:clickable="true"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:eek:nClick="onClick"
android:text="PROCEED"
android:textColor="@android:color/white"
android:textSize="@dimen/buttonTextSize" />
</android.support.v7.widget.CardView>

</RelativeLayout>

</LinearLayout>

in layout i removed the scrollview and i get the layout that is good for high resolution device but with the low resolution i do not get the whole content to see because i need to scroll down

dimens.xml


<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">

<dimen name="design_navigation_icon_size" tools:eek:verride = "true" >30dp</dimen>


// cornor radius for all button
<dimen name="cornerRadiusForButtons">5dp</dimen>

// cornor radius for all edit texts and text views and card views

<dimen name="cornerRadiusForEdittexts">5dp</dimen>

// elevation for cardView

<dimen name="elevation">15dp</dimen>

// this is the heading text size heading of all activities

<dimen name="textSize">35sp</dimen>

// used only once in userprofile below circleimageview

<dimen name="belowHeadingSize">23sp</dimen>

// this is the text that is present in the activity

<dimen name="endSize">17sp</dimen>

// button heights

<dimen name="buttonHeight">50dp</dimen>




// this is button text size

<dimen name="buttonTextSizeMain">25sp</dimen>

// donot know where does this use

<dimen name="buttonTextSize">30sp</dimen>





// width size of text view and edit texts

<dimen name="widthEditText">290dp</dimen>

// toolbar main title

<dimen name="toolbarTitle">18sp</dimen>

// toolbar subtitle

<dimen name="toolbarSubtitle">14sp</dimen>


// custom upper and lower cornors of the alert diloge etc


<dimen name="customUpperLowerCorners">5dp</dimen>



</resources>
 
Why can't you use a constraint layout? The layout editor will tell you what to add to the XML to make it compatible with devices that can't use constraint layout.

I'm curious about "devices that can't use constraint layout" - would that mainly be older devices, from before when constraint layout became available? Or are there some newer devices that would have a problem?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones