ProgressBar差距

时间:2016-03-08 20:08:51

标签: android xml

Check this image for the progressbar

知道如何消除ProgressBar下的那个小差距吗? 我怎么能没有差距?应该是通过MainActivity中的java代码还是......? 这是我的布局xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<android.support.v7.widget.Toolbar
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:elevation="4dp"
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<ProgressBar
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="wrap_content"
    android:layout_height="2.9dp"
    android:id="@+id/progressBar"
    android:background="@android:color/transparent"
    android:layout_alignParentStart="true"
    android:layout_alignParentEnd="true"
    android:layout_alignBottom="@id/my_toolbar"/>

<WebView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/webView"
    android:layout_alignParentEnd="true"
    android:layout_alignParentStart="true"
    android:layout_below="@+id/my_toolbar"
    android:layout_alignParentBottom="true" />

</RelativeLayout>

1 个答案:

答案 0 :(得分:2)

只为Progressbar

添加负边距
  

更新代码

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<android.support.v7.widget.Toolbar
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:elevation="4dp"
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<ProgressBar
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="wrap_content"
    android:layout_height="2.9dp"
    android:id="@+id/progressBar"
    android:background="@android:color/transparent"
    android:layout_alignParentStart="true"
    android:layout_alignParentEnd="true"
    android:layout_alignBottom="@id/my_toolbar"
    android:layout_marginBottom="-2dip"
/>

<WebView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/webView"
    android:layout_alignParentEnd="true"
    android:layout_alignParentStart="true"
    android:layout_below="@+id/my_toolbar"
    android:layout_alignParentBottom="true" />

</RelativeLayout>