【发布时间】:2018-06-20 08:10:20
【问题描述】:
这是我的 main_activity.xml 代码
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_home"/>
<include
android:id="@+id/appbar"
layout="@layout/appbar_main" />
</LinearLayout>
<FrameLayout
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.mindorks.placeholderview.PlaceHolderView
android:id="@+id/drawerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>
</FrameLayout>
这是我的 appbar_main.xml 活动代码
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/MyAppbar"
android:layout_width="match_parent"
android:layout_height="256dp"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="120dp">
<ImageView
android:layout_gravity="center"
android:id="@+id/imageView3"
android:layout_width="85dp"
android:layout_height="61dp"
android:src="@drawable/badge"
android:layout_marginTop="10dp" />
<TextView
android:layout_gravity="center"
android:id="@+id/nameTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Krishna Pujar"
android:textColor="@color/hintTextColor" />
<TextView
android:id="@+id/university"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="JNV Dharwad"
android:textColor="@color/hintTextColor" />
</LinearLayout>
<LinearLayout
android:layout_gravity="center"
android:layout_marginTop="60dp"
android:orientation="vertical"
android:layout_width="300dp"
android:layout_height="40dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Level - XX"
android:textColor="@color/hintTextColor" />
<TextView
android:id="@+id/points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="166dp"
android:text="1XX Points"
android:textColor="@color/hintTextColor"/>
</LinearLayout>
<ProgressBar
android:layout_gravity="center"
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:minHeight="60dp"
android:minWidth="220dp" />
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:minHeight="60dp"
tabGravity="fill"
tabIndicatorColor="#000000"
tabMode="fixed"
tabSelectedTextColor="#000000"
android:background="@color/tabs"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/pager_header"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
问题: 1.我的工具栏是半可见的 2.标签不可见
图片供您参考:
-
我的工具栏是半可见的 预期:
实际: broken toolbar Tool bar is properly visible with FLA icon
- 选项卡不可见 预期的: Tabs are visible clearly, LEARNING AND QUIZ
【问题讨论】:
-
试试`android:fitsSystemWindows="false"`
标签: android android-tablayout android-collapsingtoolbarlayout drawerlayout android-appbarlayout