Android 协调器布局在全屏模式下在底部保留填充
和许多其他用户一样,我在删除协调器布局的底部填充时遇到问题。我不确定这是因为协调器布局是在库中通过翻译实现的,没有调整大小,还是缺少一个标志 装载时: 滚动显示: 我的布局:Android 协调器布局在全屏模式下在底部保留填充,android,android-layout,android-coordinatorlayout,android-fullscreen,Android,Android Layout,Android Coordinatorlayout,Android Fullscreen,和许多其他用户一样,我在删除协调器布局的底部填充时遇到问题。我不确定这是因为协调器布局是在库中通过翻译实现的,没有调整大小,还是缺少一个标志 装载时: 滚动显示: 我的布局: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|snap">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorHeight="0dp" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<com.pitchedapps.frost.views.FrostViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/kau_fab_margin"
android:visibility="gone" />
</android.support.design.widget.CoordinatorLayout>
此布局的完整来源可在中的
activity\u main\u hidden\u tabs.xml
下找到。还有其他变体可供参考,但它们不必是全屏。尝试此链接我通过不使用协调器布局解决了此问题,而是在回收器中放置了一个卡片视图查看当我移动到更大的屏幕大小时,卡片视图中有两个文本视图文本大小指示视图并防止切断哪个部分正好有助于此?Recyclerviews可能不会剪切它,因为我希望在用户向下滚动时显示工具栏。我看穿它的唯一方法是手动设置边界,这违背了支持库的目的。这也会对fab之类的东西产生负面影响,因为fab依赖于协调器布局以获得适当的动画效果
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus && Prefs.mainActivityLayout == MainActivityLayout.FULL_SCREEN) {
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
}
}