【问题标题】:CoordinatorLayout and MapFragmentCoordinatorLayout 和 MapFragment
【发布时间】:2015-11-04 19:47:07
【问题描述】:

我在我的应用上使用CoordinatorLayoutViewPager 来显示标签。其中一个选项卡有一个RecyclerView,另一个有一个MapFragment。除了地图似乎不在屏幕上之外,我没有遇到任何问题。

它的外观如下:

这是代码:

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.view.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:contentInsetStart="72dp"
            app:navigationIcon="@drawable/ic_logo"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>

当您向上滚动时,您会看到地图和按钮正常,但我希望地图适合屏幕,我该怎么做?

【问题讨论】:

  • 您还必须发布您的代码,例如 Layout xml。
  • 分享你的xml文件。
  • @Nawako 抱歉,完全忘记了那部分:P 这是代码

标签: android android-viewpager android-coordinatorlayout


【解决方案1】:

用线性或相对布局替换你的 CoordinatorLayout,看看这是否能解决你的问题,我注意到当你移动地图时,CoordinatorLayout 中的 MapFragment 会导致一些奇怪的抖动结果。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-12
    • 1970-01-01
    相关资源
    最近更新 更多