我想在Android中創建漸變背景。我用angrytools.com來生成這兩種形狀。不完全確定如何實施它們。使用2個形狀創建自定義漸變
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="linear"
android:centerX="100%"
android:startColor="#7F000000"
android:centerColor="#FFffffff"
android:endColor="#FFffffff"
android:angle="90"/>
</shape>
-------------------------------------------------
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="radial"
android:centerX="50%"
android:centerY="50%"
android:startColor="#7F000000"
android:centerColor="#FFffffff"
android:endColor="#FFffffff"
android:gradientRadius="100"/>
</shape>
如果我沒有弄錯,只能設置一個android:background參數。 – Max
是的,我只是舉例說明...... –