Android 将抽屉布局与协调布局和FAB相结合
对于我的问题,我已经准备好了 在一个带有Android 将抽屉布局与协调布局和FAB相结合,android,android-layout,drawerlayout,floating-action-button,android-coordinatorlayout,Android,Android Layout,Drawerlayout,Floating Action Button,Android Coordinatorlayout,对于我的问题,我已经准备好了 在一个带有DrawerLayout的应用程序中,我试图显示社交网络(Google+、Facebook、Twitter)的登录页面 登录页面应显示社交网络徽标(或用户照片-如果已登录),然后显示水平进度条和浮动操作按钮,最后在底部显示一些文本: 不幸的是,我在ActionBar区域中发现了一些奇怪的人工制品,正如您在上面屏幕截图的右侧所看到的 请问为什么会发生这种情况?如何解决 这是我的带有DrawerLayout的左抽屉菜单: <android.suppor
DrawerLayout
的应用程序中,我试图显示社交网络(Google+、Facebook、Twitter)的登录页面
登录页面应显示社交网络徽标(或用户照片-如果已登录),然后显示水平进度条和浮动操作按钮
,最后在底部显示一些文本:
不幸的是,我在ActionBar
区域中发现了一些奇怪的人工制品,正如您在上面屏幕截图的右侧所看到的
请问为什么会发生这种情况?如何解决
这是我的带有DrawerLayout
的左抽屉菜单:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<FrameLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0"/>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/left_drawer"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="#FFF"
app:itemIconTint="@color/drawer_item_text"
app:itemTextColor="@color/drawer_item_text"
app:headerLayout="@layout/header_left"
app:menu="@menu/menu_main"/>
</android.support.v4.widget.DrawerLayout>
从中删除
fitsystemwindows=“true”
解决了以下问题:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/photo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.4"
android:src="@drawable/photo"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.2"
android:layout_gravity="center_horizontal"
android:text="Main profile"
/>
<TextView
android:id="@+id/given"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.2"
android:layout_gravity="center_horizontal"
/>
<TextView
android:id="@+id/place"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.2"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
<ProgressBar
android:id="@+id/progress"
android:indeterminate="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_anchor="@id/photo"
app:layout_anchorGravity="bottom"
style="?android:attr/progressBarStyleHorizontal"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:layout_anchor="@id/photo"
app:layout_anchorGravity="bottom|right|end"
android:src="@drawable/ic_account_plus_white_48dp"
android:elevation="8dp"/>
</android.support.design.widget.CoordinatorLayout>