- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
对于我的问题我准备了a simple project at GitHub .
在带有 DrawerLayout
的应用程序中,我试图显示社交网络(Google+、Facebook、Twitter)的登录页面。
登录页面应显示社交网络 Logo (或用户照片 - 如果已登录),然后是水平进度条和一个 FloatingActionButton
,最后是底部的一些文本:
不幸的是,我在 ActionBar
区域有一些奇怪的 Artifact - 正如您在上面屏幕截图的右侧所见。
请问为什么会这样,如何解决?
这是我的 activity_main.xml使用 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>
这是我的 fragment_google.xml使用 CoordinatorLayout
和 FAB
:
<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>
最佳答案
从 fragment_google.xml 中删除 fitsSystemWindows="true"
解决了问题:
关于android - 结合 DrawerLayout 与 CoordinatorLayout 和 FAB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32749857/
根据我目前的阅读,Behavior 只能应用于 CoordinatorLayout 的直接子级。但是下面的代码让我感到困惑:
CoordinatorLayout 在另一个 CoordinatorLayout 中,这样滚动 subview 也应该滚动父 CoordinatorLayout。 我有一个 coordinatorLa
我正在创建一个 Android 应用程序,我想隐藏 BottomAppBar (它有一个固定在中心的工厂)每当我滚动 RecyclerView谁在我的 Activity fragment 内而不更改
我提到了 This Question但没有答案对我有用。所以基本上我有一个 BottomNavigationView,它在向下滚动时隐藏并在向上滚动时显示。当我通过触摸滚动 Recycler View
我想向 CoordinatorLayout 添加一个页脚,其中包含一个 TabView + ViewPager。 这是 main.xml:
我有一个 CoordinatorLayout 并且我想要一个 FrameLayout 位于所有其他 Layouts 和 widgets 之下。我试过使用 android:layout_below/ab
我想用 RecyclerView 和 Toolbar 创建简单的 CoordinatorLayout,但与标准解决方案的区别在于 Toolbar 应该在底部,并且当 RecyclerView 滚动到底
我可以在我的 xml 文件中使用协调器布局,但是当我尝试将它导入我的 java 类时,它说“无法解析符号 CoordinatorLayout,而同一包中的其他类工作正常。 截图如下: 依赖项: 最佳答
我正在使用单个 Activity - 多个 fragment 结构。在 Activity 中,我使用 v7 工具栏作为操作栏。我有一些带有 viewpager 的 fragment ,有些也带有标签。
这让我抓狂。这两天我一直在努力完成这项工作,但没有取得任何进展。我想要一个应用程序栏,它在我向下滚动 ViewPager 时隐藏,并在我向上滚动 ViewPager 时显示,这似乎是标准的做法。
我需要创建一个具有线性布局的 Coordinatorlayout 和一个具有相同空间的 RecyclerView。 我试过将 layout_weight 设置为 0.5,但 RecyclerView
我尝试通过 CoordinatorLayout 获得此结果,但无法在背景上设置全屏图像,该图像在整个屏幕上展开,与图像中相同。我尝试了几种方法,例如将 LinearLayout 放入 Collapsi
我有一个包含 3 个使用回收 View 的 fragment 的 viewpager。当用户滚动回收 View 时,我试图隐藏工具栏。我的问题是工具栏在用户滚动时隐藏/显示但没有完全隐藏。我不明白我做
我有一个抽屉的主要 Activity ,抽屉有一个容器布局,我用 FragmentManager 替换每个 fragment 。 我想在滚动上隐藏/显示的我的一个子 fragment 中添加一个 FA
这里我有一个相当复杂的动画,可以使用 CoordinatorLayout 以简单的方式解决(我相信) .它有 3 个状态: 初始(左侧屏幕)- 标题 View 完全显示(橙色 背景):工具栏,灰色 r
我有一个全屏显示的 Activity。这适用于我尝试过的许多布局,但当 CoordinatorLayout 是根 ViewGroup 时除外。 CoordinatorLayout 本身的宽度和高度都设
看看下面的布局。您会看到, float 按钮距离底部太远。这是因为显示了 Toolbar 和 Tabs,并且 ViewPager 的高度不正确。所以不知何故我在 layout_height 上做错了什
我是 android Material 设计方面的新手。所以,请多多包涵。我尝试为我的家庭 Activity 实现 FAB,然后实现 snackbar 。自然,它高于我的 FAB。我研究了 Coord
我正在尝试从新发布的 Android Design Support Library 中实现 CoordinatorLayout并且我根据示例 here 在我的 XML 布局中使用了以下代码:
我正在尝试使用 RecyclerView 和 TextView 实现 CoordinatorLayout,其中 TextView 将根据您滚动 RecyclerView 的方式进行动画处理。但是我的自
我是一名优秀的程序员,十分优秀!