渐变背景

放在res/drawable下面就可以了

 

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FF000000" android:endColor="#FFFFFFFF" android:angle="90"/> <gradient android:startColor="#FFFFFFFF" android:endColor="#FF000000" android:angle="90"/> </shape> 

 

其实就是一层蒙板

 

对应的java类LinearGradient

 

比如

 

LinearGradient shader = new LinearGradient(0 ,originalImage.getHeight(), 0, bitmapWithReflection.getHeight() + reflectionGap, 0x80ffffff, 0x00ffffff, TileMode.CLAMP);

 

你可能感兴趣的:(渐变背景)