I have a progress bar defined thanks to this code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:id="@+id/fragment_article_progressBar"
android:visibility="visible"
/>
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment_article_content"/>
</LinearLayout>
But when I run it, some padding is added above and below the ProgressBar
It doesn't seem very natural.
Is it the normal style of a horizontal ProgressBar
? If no, how can I fix it?
Cheers
Try to replace
<ProgressBar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:id="@+id/fragment_article_progressBar"
android:visibility="visible"
/>
Via
<ProgressBar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:layout_marginBottom="-4dp"
android:layout_marginTop="-4dp"
android:id="@+id/fragment_article_progressBar"
android:visibility="visible"
/>
Try out as below:
<ProgressBar
android:id="@+id/fragment_article_progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-6dp"
android:layout_marginBottom="-6dp"
android:indeterminate="true"
android:max="100"
android:progress="50"
android:visibility="visible" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With