【发布时间】:2019-08-06 14:55:38
【问题描述】:
我试图将“继续”按钮放在底部,但它与底部不对齐。当我使用 ScrollView 时出现此问题,下面是 XML 和图像。我尝试了所有可能的方法,在 XML 中使用 ScrollView 将继续按钮置于底部。 如果我不包括 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 & Alex Edu\n(BPGE & 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>
【问题讨论】:
-
嗨 saad ,看看我下面的答案会解决你的问题
标签: android xml android-layout