Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set ProgressBar height

The question seems stupid but I'm not able to simply define the height of a ProgressBar. Neither in code nor the xml file. The layout_height property seems act as the margin one, and the original size is much more smaller that I want. I have found almost nothing on the subject so I'm quite confuse. The SO answer here don't works for me. And I am targeting API 15. Is anybody has a solution or an explanation ?

like image 777
FabiF Avatar asked May 20 '26 17:05

FabiF


1 Answers

It was a stupid mistake. I had paste a sample code like this :

<ProgressBar 
    android:id="@+id/status_progress" 
    style="?android:attr/progressBarStyleHorizontal"             
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/>

However the style attribute override all others...

To obtain a "basic" horizontal ProgressBar you have to set some attributes:

<ProgressBar
    android:id="@+id/pb"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:progressDrawable="@android:drawable/progress_horizontal"
    android:indeterminate="false" 
    android:indeterminateOnly="false"/> 

Of course, some other predefined styles are also available.

like image 55
FabiF Avatar answered May 22 '26 09:05

FabiF



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!