Используя Scrollview, я не могу поместить кнопку PROCEED внизу - PullRequest
0 голосов
/ 04 мая 2019

У меня проблема с использованием прокрутки, ниже приведены случаи

ДЕЛО 1

когда я не использую scrollview, я получаю макет как this , и это тот макет, который мне нужен. Проблема с этим подходом заключается в том, что при низком разрешении устройства 412 x 732 или ниже я не могу видеть все содержимое макета по этой причине мне нужен scrollview

Дело 2

если я использую вид прокрутки, я получаю вид, подобный этому это и это это идеальное и то, что мне нужно для 412 x 732 или ниже, но проблема возникает, когда я вижу макет в более высоком разрешении 1080x1920 я получаю это

, что нужно, находится в CASE 2 для устройства с более высоким разрешением, кнопка PROCEED должна касаться нижней части с bottomPadding = 20dp, как CASE 1 image

Я действительно ценю, если кто-то мне предложит приобрести макет, который работает как для устройств с высоким и низким разрешением

Компоновка

<?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:orientation="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:onClick="onClick"
                    android:text="PROCEED"
                    android:textColor="@android:color/white"
                    android:textSize="@dimen/buttonTextSize" />
            </android.support.v7.widget.CardView>

        </RelativeLayout>

    </LinearLayout>

в макете я удалил скроллвью и получил макет, который подходит для устройств с высоким разрешением, но с низким разрешением я не могу увидеть весь контент, потому что мне нужно прокрутить вниз

dimens.xml

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

 <dimen name="design_navigation_icon_size" tools:override = "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>

1 Ответ

0 голосов
/ 08 мая 2019

При добавлении этого атрибута в Scroll View моя проблема решена

 android:fillViewport="true"   
...