我希望把 SwipeRefreshLayout
外面CoordinatorLayout
含有CollapsingToolbarLayout
。当我向上滚动到顶部时,CollapsingToolbarLayout
工作正常(折叠里面的视图)。但是我向下滚动,它没有展开视图,它显示图标刷新以进行刷新。我怎么能向下滚动,它会扩展视图,然后显示图标刷新。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/srl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@color/white"
android:fitsSystemWindows="true"
app:contentScrim="@color/white"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include
layout="@layout/layout_merchant_headerinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/background_toolbar_translucent"
app:elevation="0dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ToolbarTheme" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/fragment_merchant_detail_content" />
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud) layout android swiperefreshlayout android-collapsingtoolbarlayout
基于ButterKnife lib,我升级到新版本8.5.1.我用了
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
Run Code Online (Sandbox Code Playgroud)
但它在我的Android Studio 2.3中警告我.并且ButterKnife不起作用(不能绑定视图).
警告:使用不兼容的插件进行注释处理:android-apt.这可能会导致意外行为.
我将annotationProcessor更改 为apt(apply plugin: 'com.neenbedankt.android-apt'
我的gradle中有插件)并且它在没有警告的情况下作为旧版本工作(我在旧版本8.4.0中使用了apt)
compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'
Run Code Online (Sandbox Code Playgroud)
我认为Android Studio 2.3与Annottaion处理不兼容.我搜索并发现在Android Studio 2.2中启用了注释处理器,但在Android Studio 2.3中找不到
设置>构建,执行,部署>编译器>注释处理器
有谁能解释这个问题?谢谢!