我升级到最新的支持库版本,并且滚动FAB行为无效.向下滚动RecyclerView时,它会向下滚动,但是当再次向上滚动时则不会向下滚动.它保持隐藏.降级到25.0.1似乎缓解了这个问题.这里参考的是我用于此的代码.
<android.support.v4.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
tools:context=".mainhost.MainActivity"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main_coordinator_layout_root_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".mainhost.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:focusableInTouchMode="true"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<!-- Layout for content is here. This can be a RelativeLayout -->
<FrameLayout
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="-3dp"
android:layout_marginRight="-3dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.globyworks.citykey.mainhost.MainActivity" />
<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:layout_behavior="com.globyworks.citykey.helpers.ScrollingFABBehavior"
android:src="@drawable/drawer_new_report_white" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
app:menu="@menu/menu_drawer"> …Run Code Online (Sandbox Code Playgroud) 当我在新的 Windows 10 机器上运行我的构建时,我收到一个失败的构建,并显示以下消息:
C:\Windows\room-1986fd87-5a68-4d98-8d52-10725d43f799\sqlite-3.20.1-13332950-0c44-4e15-b974-b3790f5ede28-sqlitejdbc.dll.lck (The system cannot find the path specified)
Run Code Online (Sandbox Code Playgroud) 我在Room ORM中有一个项目列表,我想在Recycler视图中显示它.数据正从网络添加到数据库.问题是每次整个列表从Flowable而不是每个项目发出时我都会得到.我试过.distinctUntilChanged没有区别.
@Query("SELECT * FROM items")
Flowable<List<Item>> getItems();
Run Code Online (Sandbox Code Playgroud)
我也尝试过只返回一个只加载第一个db的项目.
我在日志中收到此错误:
Caused by java.lang.ClassCastException: java.net.UnknownHostException cannot be cast to retrofit2.adapter.rxjava.HttpException
Run Code Online (Sandbox Code Playgroud)
那就是我的onError方法.设备没有连接时可能会导致错误.
@Override
public void onError(Throwable e) {
assert e != null;
Timber.d(e);
HttpException exception = (HttpException) e;
assert view != null;
view.hideRefreshSpinner();
if (exception.code() == HttpURLConnection.HTTP_BAD_REQUEST) {
view.showSnackbarInvalidError();
} else {
view.showUnauthorizedError();
}
}
Run Code Online (Sandbox Code Playgroud)