2014-09-30 105 views
0

我已經創建了圓形進度條,其工作正常,但問題是左右邊緣被切割。 enter image description here圓形進度條左右邊緣被切割

我無法弄清楚它爲什麼會發生或如何解決它。 及其在一個相對佈局

含有RelativeLayout的進度

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@id/Button_searchdriver_Cancel" 
    android:layout_below="@id/searchDriver_center" 
    android:padding="3dp" 
    > 

    <ProgressBar 
    android:id="@+id/Progressbar_searchdriver_timer" 
    style="@android:style/Widget.ProgressBar.Horizontal" 
    android:layout_width="120dp" 
    android:layout_height="120dp" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentTop="true" 
    android:layout_centerInParent="true" 
    android:background="@drawable/progressbackground" 
    android:indeterminate="false" 
    android:max="60" 
    android:progressDrawable="@drawable/circularprogress" /> 


    </RelativeLayout> 

對於背景和進展我有以下代碼 -

進展抽拉

<?xml version="1.0" encoding="utf-8"?> 
    <rotate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fromDegrees="270" 
    android:toDegrees="270"> 
    <shape 
    android:innerRadiusRatio="2.5" 
    android:shape="ring" 
    android:thicknessRatio="7.0"> 
    <gradient 
    android:centerColor="#ffffff" 
    android:endColor="#ffffff" 
    android:startColor="#ffffff" 
    android:angle="0" 
    android:type="sweep" 
    android:useLevel="false" /> 
    </shape> 
    </rotate> 

進展酒吧背景

<?xml version="1.0" encoding="utf-8"?> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:innerRadiusRatio="2.5" 
    android:shape="ring" 
    android:useLevel="false" 
    android:thicknessRatio="7.0"> 
    <gradient 
    android:centerColor="#000000" 
    android:endColor="#000000" 
    android:startColor="#000000" 
    android:angle="0" 
    android:type="sweep" 
    android:useLevel="false" /> 

    </shape> 

任何人都可以告訴我我做錯了什麼。

回答

1

設置

android:innerRadiusRatio="3.0" 

按照docs

innerRadiusRatio被半徑爲所述環的內部部分,表示爲 環的寬度的比。例如,如果android:innerRadiusRatio="5",則內部半徑等於環的寬度除以5.此值爲,被android:innerRadius覆蓋。默認值爲9.