Android ProgressBar尺寸可全屏显示 [英] Android ProgressBar size take whole screen

查看:313
本文介绍了Android ProgressBar尺寸可全屏显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现Android ProgressBar,但是它的大小占用了整个屏幕.我已经举了两个例子,但是没有任何效果.

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.

这是我的代码

<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和/或layout-height设置为match-parent.

The ProgressBar is taking the whole screen size, probably because you've set the layout-width and/or layout-height to match-parent.

因此,请尝试更改这些内容.

So try changing those.

或者,如果在ConstraintLayout上将layout-widthlayout-height设置为 0dp ,则请确保未将约束设置为parent在所有/相反的一侧.

Or, if you set the layout-width and layout-height to 0dp on a ConstraintLayout, then make sure you're not setting the Constraints to parent on all / opposite sides.

如果使用的是LinearLayout,并且已将layout-widthlayout-height设置为 0dp ,请确保未设置layout-weight的大小与布局的其他 widgets layout-weight太大.

If you're using a LinearLayout, and if you've set either the layout-width or layout-height to 0dp, then make sure you aren't setting the layout-weight to a size that's too different from the layout-weight of the other widgets of the layout.

希望这会有所帮助.下次,请发布您的代码或什至截屏.这使我们所有人都容易得多.

Hope this helped. Next time, please post your code or even a screenshot. That makes it a lot easier for all of us.

这篇关于Android ProgressBar尺寸可全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆