Android ProgressBar size take whole screen

孤街醉人 提交于 2019-12-11 15:58:30

问题


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" />

回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/51128644/android-progressbar-size-take-whole-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!