android - FrameLayout覆盖RelativeLayout中的ProgressBar
问题描述
在 aRelativeLayout
中,我使用ProgressBar
and 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>
解决方案
相对布局从下到上显示视图(意味着底部子视图将出现在顶部)。要解决您的问题,您只需在框架布局下方放置进度条:
<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>
推荐阅读
- api - 从沙盒到生产的 Salesforce ApexClass 部署
- jquery - 使用 jquery 在屏幕上可见时在进度条上启动动画
- r - 如果在R中创建混淆
- selenium - 如何将 chrome 扩展与特定选项卡相关联?
- snowflake-cloud-data-platform - UDF 作为雪花中的默认值
- python - 如何使用 Python 将 WEKA 分类器错误保存到 arff 文件?
- yaml - 在 YAML 中构建简单的层次结构
- c# - 使用 userid++ 存储用户 ID 有效,但 CSV 文件中三个“默认用户”的最后一个用户正在获取 useridd++
- python-3.x - 为什么由 Python 脚本运行的 MAC OS X“终端命令”会给出错误输出“找不到命令”?
- python - sys.exit 不会终止被测代码