2016-07-12 25 views
1

Hier ist my ProgressBar derzeit.Android ProgressBar machen Gradienten verblassen transparent

Beachten Sie, wie die rosa Farbe in eine hintere Farbe übergeht. Dies liegt nicht nur daran, dass der Hintergrund grau ist (dies ist nur ein Ausschnitt aus der Layout-Vorschau in Android Studio), da sogar in der App, die einen weißen Hintergrund hat, diese immer noch schwarz wird.

Was ich erreichen möchte, ist das rosa verblassen in transparent, so wie die Menge an rosa in der Steigung abnimmt, wird mehr Hintergrund sichtbar.

Weiß jemand, wie man das erreicht?

Hier ist die ziehbar für die Fortschrittsbalken:

<?xml version="1.0" encoding="utf-8"?> 
<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fromDegrees="0" 
    android:pivotX="50%" 
    android:pivotY="50%" 
    android:toDegrees="360"> 

    <shape 
     android:innerRadiusRatio="3" 
     android:shape="ring" 
     android:thicknessRatio="30" 
     android:useLevel="false"> 

    <gradient 
     android:centerColor="#00000000" 
     android:centerY="0.50" 
     android:endColor="@color/colorAccent" 
     android:startColor="@color/colorAccent" 
     android:type="sweep" 
     android:useLevel="false" /> 
    </shape> 

Und hier ist es die Erklärung in meinem Layout:

<ProgressBar 
    android:layout_width="210sp" 
    android:layout_height="210sp" 
    style="?android:attr/progressBarStyleLarge" 
    android:indeterminateDrawable="@drawable/circular_progress_bar_big" 
    android:indeterminate="false" 
    android:id="@+id/progressPose" 
    android:layout_gravity="center" 
    android:visibility="visible" 
    android:progress="100" /> 

Alle Hilfe dankbar, danke! Max

Antwort

0

für Transparenz in der Farbe verwendet diese Antwort Hex transparency in colors

  • 100% - FF
  • 95% - F2
  • 90% - E6
  • 85% - D9
  • 80% - CC
  • 75% - BF
  • 70% - B3
  • 65% - A6
  • 60% - 99
  • 55% - 8C
  • 50% - 80
  • 45% - 73
  • 40% - 66
  • 35% - 59
  • 30% - 4D
  • 25% - 40
  • 20% - 33
  • 15% - 26
  • 10% - 1A
  • 5% - 0D
  • 0% - 00

(source)

Also in Ihrem ziehbar setzen Sie Transparenz wie die für Farbe Akzent

<?xml version="1.0" encoding="utf-8"?> 
<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
android:fromDegrees="0" 
android:pivotX="50%" 
android:pivotY="50%" 
android:toDegrees="360"> 

<shape 
    android:innerRadiusRatio="3" 
    android:shape="ring" 
    android:thicknessRatio="30" 
    android:useLevel="false"> 

<gradient 
    android:centerColor="#00000000" 
    android:centerY="0.50" 
    android:endColor="@color/colorAccent" 
    android:startColor="@color/colorAccent" 
    android:type="sweep" 
    android:useLevel="false" /> 
    </shape> 
</rotate> 

Farbe.xml

50%

<color name="colorAccent">#80FF4081</color> 

85% - D9

<color name="colorAccent">#D9FF4081</color> 

usw. Sie verwenden ...

+0

Danke, perfekte Lösung. –

+0

Max hast du es gelöst .. dadurch habe ich –

+0

Yup ich ja! –