android - 为什么 CoordinatorLayout 在底部显示空白?
问题描述
嗨,我的主要活动 XML 如下
<?xml version="1.0" encoding="utf-8"?>
<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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<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="@dimen/abc_action_bar_default_height_material"
android:background="@color/fcolor"
app:popupTheme="@style/AppTheme.PopupOverlay">
<TextView
android:id="@+id/toolbar_title"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="text"
android:textColor="@color/scolor" />
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@+id/toolbar"
android:background="?attr/colorPrimary"
android:elevation="2dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabGravity="fill"
app:tabMode="fixed" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nvView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
app:headerLayout="@layout/navigation_header"
app:menu="@menu/drawer_view" />
如您所见,我使用 Include Tag 在 CoordinatorLayout 中添加了我的主要内容
<include layout="@layout/content_main" />
在内容主要 XML 中,我有
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/actvity_main" tools:context=".Main">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="@id/tab_layout"/>
</RelativeLayout>
然后我使用不同的 XML 布局在 RelativeLayout 中有 Mapview 在页面查看器中显示
我的问题是 CoordinatorLayout 左侧的屏幕底部总是有空白区域,如下图所示
如您所见,底部有空白,我之所以知道它来自 CoordinatorLayout,是因为当我更改 CoordinatorLayout 背景时,它会更改空间颜色
似乎我的包含标签在所有屏幕上都没有按比例缩放,即使我设置了
<include
layout="@layout/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
还是一样,我需要的是让我的 Mapview 缩放并填充屏幕底部
解决方案
在main.xml
,删除android:paddingBottom="3dp"
。
推荐阅读
- sql - Pivot multiple rows in initial table
- jquery - 将其他脚本用于引导模式时,数据表的功能将被禁用
- mongodb - mongodb 上限集合从偏移量消耗
- python - 在没有 NLTK 的情况下删除文本文件中的停用词
- windows - 路径太长_截断为 1024 个字符_路径无法编辑
- docker - Can't push image to google container registry - Caller does not have permission 'storage.buckets.get'
- javascript - ReactiveX: filter out numbers from observable so that total never goes below zero
- javascript - fieldChanged() method not called when "field.property" is changed from child component
- javascript - jsPDF-AutoTable “doc.autoTable 不是函数”
- asp.net - could not load file or assembly Nlog.web.aspnetcore or one of its dependencies