My activity_main.xml
is below, as you see, the height is set 40 dip.
And in MyEclipse, it looks like below:
Many solution here with lot of upvotes didn't work for me, even the accepted answer. I solved it by setting the scaleY, but isn't a good solution if you need too much height because the drawable comes pixelated.
Programmatically:
progressBar.setScaleY(2f);
XML Layout:
android:scaleY="2"
This is the progress bar I have used.
<ProgressBar
android:padding="@dimen/dimen_5"
android:layout_below="@+id/txt_chklist_progress"
android:id="@+id/pb_media_progress"
style="@style/MyProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:progress="70"
android:scaleY="5"
android:max="100"
android:progressBackgroundTint="@color/white"
android:progressTint="@color/green_above_avg" />
And this is my style tag
<style name="MyProgressBar" parent="@style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressBackgroundTint">@color/white</item>
<item name="android:progressTint">@color/green_above_avg</item>
</style>
values->styles.xml
<style name="tallerBarStyle" parent="@android:style/Widget.SeekBar">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@android:drawable/progress_horizontal</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item>
<item name="android:minHeight">8dip</item>
<item name="android:maxHeight">20dip</item>
</style>
Then in your ProgressBar add:
style="@style/tallerBarStyle"
I guess the simplest solution would be:
mProgressBar.setScaleY(3f);
You can use the LinearProgressIndicator
provided by the Material Components Library and the app:trackThickness
attribute:
<com.google.android.material.progressindicator.LinearProgressIndicator
android:indeterminate="true"
app:trackThickness="xxdp"
../>
With 12dp
:
With 4dp
:
Note: it requires at least the version 1.3.0-alpha04
.