2016-08-01 12 views
1

私はxmlを通して設計した円形のプログレスバーを持っています。問題は、layout_widthとlayout_heightをwrap_contentに設定すると、サークルが切断されることです。私が幅と高さを手動で "__dp"に設定すると、あまりにも大きく広がる円の周りに巨大なボックスがあります。より明確に説明するために、私の進行状況バーはあなたがそれに触れると始まります。ただし、この境界線を境にして、進行状況バーの横に触れても(開始しない場合)開始されます。この境界線を削除するにはどうしたらいいですか?ありがとう!あなたは間違ったスタイルを設定Android、円形の進行状況バーの周りに四角い枠を外します

enter image description here

<ProgressBar 
    style="?android:attr/progressBarStyleHorizontal" 
    android:id="@+id/progressBar" 
    android:layout_width="200dp" 
    android:layout_height="200dp" 
    android:indeterminate="false" 
    android:progressDrawable="@drawable/circular_progress_bar" 
    android:background="@drawable/circle_shape" 
    android:max="100" 
    android:layout_alignParentBottom="true" 
    android:layout_centerInParent="true" 
    /> 

circle_shape.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="ring" 
    android:innerRadiusRatio="7" 
    android:thickness="5dp" 
    android:useLevel="false"> 

    <solid android:color="#CCC" /> 

</shape> 

circular_progress_bar.xml

<?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="7" 
     android:shape="ring" 
     android:thickness="5dp" 
     android:useLevel="true"> 

     <gradient 
      android:angle="0" 
      android:endColor="#007DD6" 
      android:startColor="#007DD6" 
      android:type="sweep" 
      android:useLevel="false" /> 
    </shape> 
</rotate> 

答えて

1

style="?android:attr/progressBarStyleHorizontal" 

は、水平ProgressBarsを意味する。スタイルを削除するか、円形のために使用するものを使用してください

style="@style/Base.Widget.AppCompat.ProgressBar" 
+0

私はそれを実行するとまだ周囲にボックスがあります。 – Jill

+0

どこかで使用している2つのドロワブルを投稿できますか? – FWeigl

+0

質問に追加しましたか? – Jill

関連する問題