ProgressBar and progressBarStyleHorizontal padding

I have a progress bar defined by 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, adding add-ons is added above and below the ProgressBar

enter image description here

This does not seem very natural.

Is this a regular horizontal ProgressBar bar style? If not, how can I fix it?

Greetings

+5
source share
2 answers

Try replacing

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

Through

  <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" /> 
+4
source

Try the following:

  <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" /> 
+2
source

All Articles