我需要在slidingTabLayout的顶部放置一个按钮。我用了layout_below。但是,它没有用。请查看我的XML和片段代码。
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<!-- TODO: Update blank fragment layout -->
<Button
android:id="@+id/charge_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/charge" />
<tabs.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:elevation="1dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/charge_button"/>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_below="@+id/sliding_tabs">
</android.support.v4.view.ViewPager>
</FrameLayout>
// Charge是这里的按钮名称
答案 0 :(得分:-1)
你必须这样设置抱歉我没有正确理解你的要求现在得到你不能重叠布局的点你必须使用java代码设置标题,通过添加片段到标题的滑动布局。 https://stackoverflow.com/a/37833589/4574463