Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProgressBar and progressBarStyleHorizontal padding [duplicate]

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

like image 982
Vico Avatar asked May 08 '15 04:05

Vico


2 Answers

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"
        />
like image 53
Krupa Patel Avatar answered Nov 08 '22 08:11

Krupa Patel


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" />
like image 1
GrIsHu Avatar answered Nov 08 '22 06:11

GrIsHu