我的片段包含许多不同的视图。一些视图已经在 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>