【发布时间】:2020-10-20 08:53:18
【问题描述】:
我的片段包含许多不同的视图。一些视图已经在 XML 文件中,如 imageview、drawables 等,而其他视图在 Retrofit 成功响应后填充数据。 XML 文件还包含一个工具栏和progressbar。
当数据来自服务器时,我只想显示工具栏和进度条并隐藏其他内容。但问题是我无法隐藏整个视图,因为它本身包含工具栏和进度条。
我该怎么办?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar...>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh_open_post"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom_sec">
<!-- this contains all Content I want to hide this -->
<ScrollView...>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<!-- this contains content which is fixed at the bottom I also want to hide this -->
<FrameLayout...>
<include layout="@layout/progressbar_item" />
</RelativeLayout>
【问题讨论】:
-
你能分享你的xml代码吗?
-
是的,请查看@MuntasirAonik
标签: android android-layout android-fragments android-progressbar