Ich versuche, einen transparenten Hintergrund mit Farbverlauf für eine Schaltfläche, um so etwas zu machen:Linear Gradient CenterX
(Die Startfarbe nicht grau ist aber transparent)
Aber ich bin immer dies: (wo weiße Teil ist zu schmal)
Das ist mein gradient.xml:
<!-- Here centerX does not work -->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:centerX="30%"
android:startColor="@android:color/transparent"
android:endColor="@android:color/white"/>
</shape>
ich auch versucht haben, das Hinzufügen einer centerColor
, aber dann der transparente Bereich wird grau!
<!-- Here the startColor turns greyish -->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:centerColor="@android:color/white"
android:centerX="30%"
android:endColor="@android:color/white"
android:startColor="@android:color/transparent" />
</shape>
Vielen Dank im Voraus!
Funktioniert nicht:/Was ich brauche ist, dass 75% des Hintergrunds der Schaltfläche weiß sind und der Rest nach und nach transparent wird – josemigallas