【发布时间】:2016-09-07 15:52:50
【问题描述】:
我在片段中有一个 tablayout 和一个 viewpager。我的标签布局中有两个标签。和我的 app_bar_main.xml 中的工具栏。但是当我运行我的应用程序时,tablayout 隐藏了工具栏。它如何放置在工具栏之后? 这是我的代码 这是我的 app_bar_main.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#CC0000"
android:titleTextColor="@color/white"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragment_containerlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"></FrameLayout>
这是我的片段设计,我在其中放置了选项卡布局和视图寻呼机
<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"
tools:context="com.example.nayab.demotask.ContactsFragment"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/contactstablayot"
android:layout_gravity="left|top"
android:background="#000000"
app:tabTextColor="@android:color/white"
/>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragviewpager"
android:layout_gravity="left|center_vertical"
android:layout_marginTop="30dp"
android:background="#e6f1f5"
/>
谁能帮帮我
【问题讨论】:
-
你想在这里实现什么?只有一个屏幕,顶部有工具栏,下方有标签布局?
标签: android xml android-viewpager toolbar android-tablayout