5

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

enter image description here

It doesn't seem very natural.

Is it the normal style of a horizontal ProgressBar? If no, how can I fix it?

Cheers

Vico
  • 1,696
  • 1
  • 24
  • 57

2 Answers2

4

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"
        />
Krupa Patel
  • 3,309
  • 3
  • 23
  • 28
1

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" />
GrIsHu
  • 29,068
  • 10
  • 64
  • 102