【发布时间】:2017-02-17 06:32:50
【问题描述】:
我想在调用 SwipeRefreshLayout Listener 时将整个布局下移?这件事在android中可能吗? 这是我的整个 xml 布局。SwipeRefreshLayout 包含一个进度条和 FrameLayout,并且包含在一个 RelativeLayout 中。所以我希望 FrameLyout 在我调用刷新时应该下拉。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_navigation_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_layout" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ProgressBar
android:id="@+id/horizontal_sync_progress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/gradient_bg_end"
android:indeterminateDrawable="@drawable/progress_drawable"
android:progressDrawable="@drawable/progress_drawable"
android:visibility="gone"/>
<FrameLayout
android:id="@+id/container_frag"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
【问题讨论】:
-
你现在尝试了什么?请发布一些代码
-
你必须在 xml 文件的顶部设置 SwipeRefreshLayout。
-
ya..我会分享我的 xml
-
set SwipeRefreshLayout android:layout_height="wrap_content" 它解决了我的问题
-
请贴出完整的xml代码
标签: android android-scrollview pull-to-refresh swiperefreshlayout