[英]How can i make a Button in android appear in a fixed position and always in front of all other views?
我知道代碼可能格式不正確,但我希望按鈕(最后一個標簽)總是出現在所有其他視圖的前面,如果描述很長,按鈕就會消失。 我正在使用 scrollView 並且如果出現任何長文本,但這會使按鈕 go 在屏幕下方。
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center|bottom"
android:orientation="vertical">
<Button
android:layout_gravity="bottom|end"
android:id="@+id/cart_button"
android:layout_width="250dp"
android:layout_height="55dp"
android:layout_marginBottom="10dp"
android:iconTint="@color/black"
android:elevation="6dp"
android:text="ADD TO CART"
android:textAppearance="?attr/textAppearanceButton"
android:textColor="#28022E"
android:textSize="20sp"
app:backgroundTint="#F6F2FA"
app:elevation="10dp"
app:rippleColor="#FFF"
app:shapeAppearance="?attr/shapeAppearanceSmallComponent"
app:strokeColor="#0000"
app:strokeWidth="10dp" />
</RelativeLayout>
將您的按鈕從滾動視圖中取出。 就像是:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
// content that you wants to scroll
</ScrollView>
<Button alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.