我的主要活动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缩放并填充屏幕底部
答案 0 :(得分:2)
在main.xml
中,删除android:paddingBottom="3dp"
。
答案 1 :(得分:1)
试试这个。
尝试使用java代码
mapView.setBuiltInZoomControls(true);
int level = mapView.getZoomLevel();
MapController mc = mapView.getController();
mc.setZoom(level + 3);
和你的xml
<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="fill_parent"
android:layout_height="fill_parent">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
让我知道它是否适合你。
答案 2 :(得分:0)
看起来问题是我在java代码中添加了填充值 感谢大家帮我查看代码中的填充
答案 3 :(得分:0)
在内容主要尝试从RelativeLayout中删除:
android:layout_below="@id/tab_layout"
从ViewPager移动:
<include layout="@layout/content_main" />
到了
android:layout_height="fill_parent"
并在ViewPager中更改:
android:layout_height="match_parent"
至
DECLARE @stores TABLE(StoreID INT, [Month] VARCHAR(6), Sales INT);
INSERT INTO @stores(StoreID, Month, Sales)
VALUES(119119, '201802', 50000),
(119119, '201803', 62500),
(119119, '201804', 93750),
(119119, '201708', 45000),
(119271, '201803', 25000),
(119271, '201804', 75000),
(119271, '201802', 50000);
WITH
Sales AS (SELECT StoreID, CAST([Month]+'01' AS DATE) AS [Month], Sales FROM @stores)
SELECT s1.StoreID, s1.[Month], SUM(s2.Sales) AS total
FROM Sales s1
inner JOIN Sales s2 ON s1.StoreID=s2.StoreID
AND s1.[Month]>=s2.[Month]
AND DATEDIFF(MONTH, s2.[Month], s1.[Month])<5
GROUP BY s1.StoreID, s1.[Month]
ORDER BY s1.StoreID, s1.[Month];