首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >CoordinatorLayout上不活动的白底部空间

CoordinatorLayout上不活动的白底部空间
EN

Stack Overflow用户
提问于 2017-01-06 11:14:27
回答 1查看 1.7K关注 0票数 1

我有带有CoordinatorLayout的xml文件。

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:visibility="visible"
    android:gravity="center_horizontal">
            <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="wrap_content">
                <android.support.design.widget.AppBarLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                    android:layout_marginStart="4dp"
                    android:layout_marginEnd="4dp"
                    android:layout_marginLeft="4dp"
                    android:layout_marginRight="4dp">
                    <android.support.design.widget.TabLayout
                        android:id="@+id/tabLayout"
                        app:tabBackground="@drawable/my_tab_item_bg_selector"
                        app:tabMaxWidth="0dp"
                        app:tabGravity="fill"
                        app:tabMode="fixed"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
                </android.support.design.widget.AppBarLayout>
                <android.support.v4.view.ViewPager
                    android:id="@+id/viewPager"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
            </android.support.design.widget.CoordinatorLayout>
</LinearLayout>  

还有另一个xml文件,我把它放在了协调器布局上。

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/nestedScrollData"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">
    <LinearLayout
        android:id="@+id/layoutDataDispatchContacts"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:gravity="center_horizontal">

        <LinearLayout
            android:id="@+id/layoutFullTableDispatchContacts"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:gravity="center_horizontal"
            android:background="@drawable/layout_block_background">
            <LinearLayout
                android:id="@+id/tableLinearLayoutDispatchContacts"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:gravity="center_horizontal">
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</android.support.v4.widget.NestedScrollView>

我捕捉到空洞的空间,它覆盖了我的部分窗口,不能点击。这是在下面的屏幕截图上:不可点击的非活动底部空间我注意到当我从不可点击的非活动底部空间中删除ViewPager时,bug就消失了。但我的标签也不见了。我认为它创造了一些看不见的工具栏或类似的东西。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-09 11:58:45

由于CoordinatorLayout是子视图的父级,所以要占据全屏,需要设置匹配父视图的高度,而不是像下面这样的wrap_content:

android:layout_height="match_parent“

一切都会好的。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41504480

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档