我想制作一个位于底部的按钮,并显示在所有片段上。这是包含片段的活动的xml布局。片段滚动和底部按钮始终显示:制作一个在所有片段中显示的按钮android
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_store_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sendbest.ibooking.ibooking_customer.StoreInfo">
<com.ogaclejapan.smarttablayout.SmartTabLayout
android:id="@+id/viewpagertab"
android:layout_width="match_parent"
android:layout_height="48dp"
app:stl_indicatorAlwaysInCenter="false"
app:stl_indicatorWithoutPadding="false"
app:stl_indicatorInFront="false"
app:stl_indicatorInterpolation="smart"
app:stl_indicatorGravity="bottom"
app:stl_indicatorColor="#ff4081"
app:stl_indicatorThickness="4dp"
app:stl_indicatorWidth="auto"
app:stl_indicatorCornerRadius="2dp"
app:stl_overlineColor="#4D000000"
app:stl_overlineThickness="0dp"
app:stl_underlineColor="#4D000000"
app:stl_underlineThickness="1dp"
app:stl_dividerColor="#4D000000"
app:stl_dividerThickness="1dp"
app:stl_defaultTabBackground="?attr/selectableItemBackground"
app:stl_defaultTabTextAllCaps="true"
app:stl_defaultTabTextColor="#4D000000"
app:stl_defaultTabTextSize="12sp"
app:stl_defaultTabTextHorizontalPadding="16dp"
app:stl_defaultTabTextMinWidth="0dp"
app:stl_distributeEvenly="false"
app:stl_clickable="true"
app:stl_titleOffset="24dp"
app:stl_drawDecorationAfterTab="false"
/>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/viewpagertab"
/>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/viewpager"
android:gravity="bottom"
android:text="bottom button"
android:background="#e50013"
android:id="@+id/btShopping"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
该标签和viewpager现在工作正常,但无法显示该按钮。什么是正确的方式来应用这个?
谢谢你,我没有尝试过放置layout_above,但没有删除layout_below。这解决了它,我会接受你的答案一旦时间到了 – JerryKo
太好了。随时准备帮助:) –