我在底页中有 recyclerview,效果很好。当我在回收器视图周围引入 swiperefreshlayout 时,它不允许我向上滚动,它只会折叠底部表格。我希望它滚动回收器视图,到达顶部,然后触发刷新。如果需要的话,我可以消除底页上的拖动折叠行为。
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
app:behavior_peekHeight="?actionBarSize"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" >
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:visibleGone="@{ model.locPerms }"
app:onRefreshListener="@{ () -> model.refreshPois() }"
app:refreshing="@{ model.refreshing }">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_pois"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
tools:listitem="@layout/poi_item"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud) 所以我正在试验Angular.我创建了以下模块.
var archiveModule = angular.module('archiveModule', ['ngResource']);
archiveModule.factory('Archive', ['$resource',
function($resource) {
return $resource('/data/archive/:doc.json', {}, {
query: { method:'GET', params:{ doc: undefined }, isArray:true }
});
}]);
archiveModule.controller('ArchiveControl', ['$scope', '$http', 'Archive',
function ($scope, Archive) {
$scope.items = Archive.query();
$scope.orderProp = 'name';
}]);
Run Code Online (Sandbox Code Playgroud)
我的模板一切都发生在:
<div class="container" ng-app="archiveModule">
<div ng-controller="ArchiveControl">
Run Code Online (Sandbox Code Playgroud)
我在页面底部包含了角度脚本:
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular-resource.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular-route.js"></script>
Run Code Online (Sandbox Code Playgroud)
Chrome报道TypeError: undefined is not a function,它又回归了$scope.items = Archive.query();.
根据http://docs.angularjs.org/api/ngResource.$ resource,查询是$ resource的一部分,我模拟了我的资源http://docs.angularjs.org/tutorial/step_11我不知道是什么这里出错了.