Android 使用循环视图滚动状态栏
您好,我遇到了一个奇怪的问题,当我滚动我的回收视图时,我的状态栏向上滚动。其他一切都正常工作。我相信这是我的布局添加的方式,但我不确定问题可能在哪里。如果你有任何想法,请告诉我。谢谢大家! 代码: 主应用程序Android 使用循环视图滚动状态栏,android,android-layout,android-fragments,android-recyclerview,android-toolbar,Android,Android Layout,Android Fragments,Android Recyclerview,Android Toolbar,您好,我遇到了一个奇怪的问题,当我滚动我的回收视图时,我的状态栏向上滚动。其他一切都正常工作。我相信这是我的布局添加的方式,但我不确定问题可能在哪里。如果你有任何想法,请告诉我。谢谢大家! 代码: 主应用程序 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/re
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.application.app.Activity.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="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
主要内容
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.application.app.Activity.MainActivity"
tools:showIn="@layout/app_bar_main">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frame">
</FrameLayout>
</RelativeLayout>
碎片
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recyclerView"
android:layout_height="match_parent"
android:layout_width="match_parent"
/>
</RelativeLayout>
最后一行代码将允许工具栏向上滚动。但你说的是“状态栏”,所以我不知道这是否对你有帮助。当我需要向上滚动我的“状态栏”时,我会在活动代码中进行。它可能在您的布局中不起作用。尝试删除
app:layout\u行为=“@string/appbar\u scrolling\u view\u behavior
来自RelativeLayout
@vpaliyX谢谢你是的,我也试过这么做,但运气不好,可能是因为它在片段中?而不是实际的活动?谢谢,是的,它也会滚动工具栏,但状态栏不会停留并隐藏工具栏内容,它也会向上移动,这让它很奇怪
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:layout_scrollFlags="scroll|enterAlways" />