簡體   English   中英

ScrollView XML View At Bottom

[英]ScrollView XML View At Bottom

我試圖將Proceed按鈕帶到底部,但它沒有與底部對齊。 當我使用ScrollView時,會出現此問題,下面是XML和圖像。 我嘗試了所有可能的方法,使用ScrollView在XML底部帶來了繼續按鈕。 如果我不包括scrollView,則布局將根據我的需要

截圖

<?xml version="1.0" encoding="utf-8"?>
   <ScrollView android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/backgroundColor"
    xmlns:android="http://schemas.android.com/apk/res/android">

<LinearLayout 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: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: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: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_marginTop="20dp"
        android:layout_marginBottom="20dp"
        android:layout_gravity="center"
        android:layout_height="match_parent">  

        <android.support.v7.widget.CardView
            android:layout_width="230dp"    
            app:cardElevation="@dimen/elevation"
            app:cardCornerRadius="@dimen/cornerRadiusForButtons"
            app:cardBackgroundColor="@color/functionalityColor"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="20dp"
            android:layout_height="@dimen/buttonHeight">

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

    </RelativeLayout>

</LinearLayout>        

</ScrollView>

在布局文件中使用此xml代碼,它將使“繼續”按鈕保持關閉狀態

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/backgroundColor">

        <LinearLayout 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/backgroundColor"
            android:orientation="vertical">


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

            <TextView
                android:id="@+id/belowHeadingText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="5dp"
                android:layout_marginTop="20dp"

                android:layout_marginEnd="5dp"
                android:gravity="center"
                android:text="Beijing Pinnacle Global &amp; Alex Edu\n(BPGE &amp; Alex Edu)"
                android:textColor="@android:color/white"
                android:textSize="@dimen/endSize" />


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

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

            </View>


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

                />

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


        </LinearLayout>


    </ScrollView>

    <android.support.design.widget.BottomNavigationView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:orientation="vertical">

        <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
                app:cardBackgroundColor="@color/functionalityColor"

                app:cardCornerRadius="@dimen/cornerRadiusForButtons"
                app:cardElevation="@dimen/elevation"
                android:layout_width="230dp"
                android:layout_height="@dimen/buttonHeight"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"

                android:layout_marginBottom="20dp">

                <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>

    </android.support.design.widget.BottomNavigationView>
</RelativeLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM