Android ProgressBar size take whole screen


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





Post your code so we know what's the problem is
– Tam Huynh
Jul 2 at 3:09






post a screenshot...and always post your code....
– Abhi
Jul 2 at 4:05




1 Answer
1



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


layout-width


layout-height


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.


layout-width


layout-height


ConstraintLayout


parent



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.


LinearLayout


layout-width


layout-height


layout-weight


layout-weight



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






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages