在RelativeLayout中,我使用ProgressBar和FrameLayout。我用不同的片段初始化FrameLayout。
但是,我看不到ProgressBar,因为FrameLayout涵盖了它。我不想要这个。
我想把ProgressBar放在FrameLayout之上(它们应该是重叠的,但是ProgressBar应该在上面)。
我怎么能这么做?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ProgressBar
android:id="@+id/mainProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@+id/frameLayout"
android:layout_marginTop="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>发布于 2020-04-27 17:18:05
相对布局显示自下而上的视图(意味着底部子视图将出现在顶部)。要解决您的问题,只需将进度栏放在framelayout下面:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/frameLayout"
android:layout_marginTop="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<ProgressBar
android:id="@+id/mainProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RelativeLayout>https://stackoverflow.com/questions/61427429
复制相似问题