底部按钮覆盖了滚动视图的一部分
bottom button covers part of scrollview
我正在底部添加滚动视图和按钮。我遇到的问题是我的按钮隐藏了滚动视图的最后一部分。这是我的 xml 代码..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
.
.
Code for some cardviews
.
.
.
.
</RelativeLayout>
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"/>
</RelativeLayout>
我得到的视图是...
在私人教练之后,我又为社区成员提供了一张卡片视图,但没有显示。有人可以帮我解决这个问题吗??
提前致谢:)
试试这个:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray"
android:orientation="vertical">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<!-- Your card layout -->
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"/>
</LinearLayout>
<Button
android:layout_below="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"/>
试试这个。
为您的 Button
提供 ID
<Button android:id="@+id/btn"
android:layout_width="match_parent"
...
将您的 scrollView
设为高于 Button
<ScrollView
android:id="@+id/scroll_view"
android:layout_above="@+id/btn"
...
改变这个
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="dp_of_your_choice">//need to try 300,400,500 and see how it works
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
//.
//.
//Code for some cardviews
//.
//.
//.
//.
</RelativeLayout>
<scrollView>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"/>
我正在底部添加滚动视图和按钮。我遇到的问题是我的按钮隐藏了滚动视图的最后一部分。这是我的 xml 代码..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
.
.
Code for some cardviews
.
.
.
.
</RelativeLayout>
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"/>
</RelativeLayout>
我得到的视图是...
在私人教练之后,我又为社区成员提供了一张卡片视图,但没有显示。有人可以帮我解决这个问题吗?? 提前致谢:)
试试这个:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray"
android:orientation="vertical">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<!-- Your card layout -->
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"/>
</LinearLayout>
<Button
android:layout_below="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"/>
试试这个。
为您的 Button
<Button android:id="@+id/btn"
android:layout_width="match_parent"
...
将您的 scrollView
设为高于 Button
<ScrollView
android:id="@+id/scroll_view"
android:layout_above="@+id/btn"
...
改变这个
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="dp_of_your_choice">//need to try 300,400,500 and see how it works
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
//.
//.
//Code for some cardviews
//.
//.
//.
//.
</RelativeLayout>
<scrollView>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="5000/- CHECKOUT"
android:textColor="@color/white"
android:textSize="25dp"
android:layout_alignParentBottom="true"
android:background="@color/orange"/>