gpt4 book ai didi

android - DrawerLayout + app bar +CoordinatorLayout 拉动刷新

转载 作者:行者123 更新时间:2023-11-29 01:20:49 25 4
gpt4 key购买 nike

我现在想在 . content_main 有 viewpager 和 recycleview 。

所以我怎么才能拉动刷新整页

基础.xml

 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
android:fitsSystemWindows="true">


<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"

android:fitsSystemWindows="true">

app_bar_main.xml

        <android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:expandedTitleGravity="center"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

<android.support.v4.view.ViewPager

android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="?attr/actionBarSize"

app:layout_collapseMode="pin" />

  <include layout="@layout/content_main" />

</android.support.design.widget.CoordinatorLayout>

最佳答案

看看这段代码:

<android.support.v4.widget.DrawerLayout             
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
android:fitsSystemWindows="true">


<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/app_bar_main" />

<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent">


<include layout="@layout/content_main" />
</android.support.v4.widget.SwipeRefreshLayout>

</android.support.design.widget.CoordinatorLayout>

<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">

</android.support.v4.widget.DrawerLayout>

关于android - DrawerLayout + app bar +CoordinatorLayout 拉动刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36910102/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com