【发布时间】:2018-02-13 21:19:51
【问题描述】:
我尝试在this tutorial
滚动列表上隐藏工具栏
它在我的一个项目中工作,但是当我在另一个项目中尝试时,RecycleView 根本不滚动
而不是 RecycleView,工具栏是可滚动的!
我的意思是我可以通过滚动工具栏来隐藏工具栏(上下滑动工具栏)
app_bar_main.xml:
<?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"
tools:context="bearing.chavosh.com.bearingdemo.Activity.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/app_bar_background"
android:theme="@style/AppTheme.AppBarOverlay"
android:background="#f5f5f5">
<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:theme="@style/AppTheme.AppBarOverlay"
app:theme="@style/ThemeOverlay.AppCompat.Light"
app:popupTheme="@style/AppThemePopupOverlayLight">
<bearing.chavosh.com.bearingdemo.Utility.MyTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ارسال موقعیت"
android:textSize="17sp"
android:textColor="#000000"
android:layout_gravity="center"
android:id="@+id/toolbar_title" />
</android.support.v7.widget.Toolbar>
<View
android:layout_width="match_parent"
android:layout_height="0.25dp"
android:id="@+id/viewShadow"
android:background="#BBBBBB"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_height="match_parent"
android:layout_width="match_parent" />
</android.support.design.widget.CoordinatorLayout>
content_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#f5f5f5"
tools:context="bearing.chavosh.com.bearingdemo.Activity.MainActivity"
tools:showIn="@layout/app_bar_main">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/llBarsList">
<include layout="@layout/loads_list"
android:layout_height="match_parent"
android:layout_width="match_parent" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
上面源代码中包含的load_list.xml:
<?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:background="#f5f5f5"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:showIn="@layout/content_main">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f5f5f5"
app:tabIndicatorColor="#0067A5"
app:tabIndicatorHeight="2dp"
app:tabMode="scrollable"
app:tabGravity="center"/>
<View
android:layout_width="match_parent"
android:layout_height="0.25dp"
android:layout_below="@+id/tabs"
android:id="@+id/viewShadow"
android:background="#BBBBBB"/>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/viewShadow"
android:id="@+id/vp_bars_list" />
</RelativeLayout>
我没有找到任何答案,我研究了一天
任何帮助,请
【问题讨论】:
-
确保您使用相同的支持库版本
-
@MohammadRezaEram 感谢您的回答,但这对我没有帮助,我在两个项目中都使用相同的库
-
你应该检查支持设计库
-
@MohammadRezaEram 两个项目中的所有库都相同:(
标签: android scroll android-recyclerview