android - Android ProgressBar size take whole screen
问题描述
I'm trying to implement an Android ProgressBar but its size is taking the whole screen. I've followed a couple of examples but it didn't make any effect.
Here is my code
<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="false"
android:padding="45dp"
android:visibility="gone" />
解决方案
ProgressBar占用整个屏幕大小,可能是因为您已将layout-width
and/or设置layout-height
为match-parent
.
所以试着改变那些。
或者,如果您在 a上将layout-width
and设置layout-height
为0dpConstraintLayout
,那么请确保您没有将Constraints设置为parent
所有/相对侧。
如果您使用的是LinearLayout
,并且您已将layout-width
或设置layout-height
为0dp,请确保您没有将 设置为与布局的其他小部件layout-weight
的尺寸相差太大的尺寸。layout-weight
希望这有帮助。下次,请发布您的代码甚至截图。这让我们所有人都轻松多了。
推荐阅读
- flatbuffers - 使用 flatbuffers 结构作为键
- html - 使用 CSS Grid 的动态高度
- onedrive - 使用 Microsoft OneDrive REST API 时身份验证令牌无效
- laravel - 如何使用刀片模板中的类?
- android - 时间选择器对话框不显示
- azure - 选择哪个 Azure 消息传递服务以向不同订阅者发布不同的消息?
- android - Kotlin Android Extensions 替换 findViewById 如何防止空视图?
- android - 如何在对象 Gson/Retrofit2 中获取字符串
- python - 确定性转换在 pymc3 模块中到底做了什么
- php - 为什么 Laravel-json-api 更新不起作用?