相关疑难解决方法(0)

Android-footer在CoordinatorLayout中使用时滚动屏幕

AppBarLayout滚动时,我有一个滚动屏幕RecyclerView.下方RecyclerView还有一个RelativeLayout是页脚.

页脚仅在向上滚动后显示 - 它表现得像它一样

layout_scrollFlags="scroll|enterAlways"
Run Code Online (Sandbox Code Playgroud)

但它没有任何滚动标志 - 它是一个错误还是我做错了什么?我希望它始终可见

在滚动之前

在此输入图像描述

滚动后

在此输入图像描述

更新

打开谷歌问题 - 它被标记为'WorkingAsIntended'这仍然没有帮助,因为我想要一个片段内的页脚的工作解决方案.

更新2

你可以在这里找到活动和片段xmls -

请注意,如果第34 activity.xml行 - 包含的行app:layout_behavior="@string/appbar_scrolling_view_behavior"被注释掉,则文本末尾从头开始可见 - 否则,只有在向上滚动后才可见

android android-5.0-lollipop android-design-library android-coordinatorlayout

57
推荐指数
3
解决办法
2万
查看次数

Android - 框架布局高度与协调器布局不匹配

我的FrameLayout(抽屉布局中的容器)有问题.FrameLayout的高度超过屏幕高度(在底部的android默认菜单按钮下方).

<android.support.design.widget.CoordinatorLayout
        android:id="@+id/main_content"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

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

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="?attr/actionBarSize"
                app:layout_scrollFlags="scroll|enterAlways" />

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

        <FrameLayout
            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.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

高度超过Android Studio Designer中显示的高度

height android matching android-framelayout

10
推荐指数
1
解决办法
4885
查看次数

在ViewPager中切换页面时显示工具栏

我之前搜索过堆栈溢出,但没有找到适合我的问题的答案.

我有一个带有协调器布局的Android应用程序,里面有一个嵌套的ViewPager.如果我在View分页器中滚动第一个片段内的RecyclerView,则隐藏工具栏并按预期显示.但是,我在ViewPager中的其他片段没有嵌套滚动,所以我想显示工具栏是否隐藏在ViewPager页面更改上.我想知道我是否可以扩展CoordinatorLayout行为以完成它.

提前致谢!如果需要,我很乐意提供更多细节.

大概的代码是(试图剥离所有不必要的东西): main_activity.xml

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways" />
        <android.support.design.widget.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/toolbar" />
    </android.support.design.widget.AppBarLayout>
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/tab_layout"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

和滚动片段: fragment.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<android.support.v7.widget.CardView
    android:id="@+id/add_word_card"
    android:orientation="horizontal"
    android:layout_height="wrap_content"
    android:layout_width="match_parent">
    <RelativeLayout
        android:id="@+id/add_word_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/highlight">
        <!-- some unrelated stuff -->
    </RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.RecyclerView
        android:id="@+id/list"
        android:layout_below="@id/add_word_card"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:context=".MainActivity"/>
Run Code Online (Sandbox Code Playgroud)

我发现了一些相关的问题:这个或者这个.但是他们主要关注布局问题,而我想了解是否真的有一个很好的解决方案来按需触发工具栏移动.

android android-layout android-fragments android-recyclerview android-coordinatorlayout

2
推荐指数
1
解决办法
881
查看次数