如何申请光晕效果?
我想创建这种类型的水平进度
但不知道有关的进步为出发点的发光效果。
下面是我的$ C $下的渐变色
< XML版本=1.0编码=UTF-8&GT?;
<层列表的xmlns:机器人=http://schemas.android.com/apk/res/android>
<项目机器人:ID =@机器人:ID /背景>
<形状>
<边角机器人:半径=0dip/>
[固体机器人:颜色=#ff9d9e9d/>
< /形状>
< /项目>
<项目机器人:ID =@机器人:ID / secondaryProgress>
<夹>
<形状>
<边角机器人:半径=5dip/>
<梯度
机器人:角=180
机器人:startColor =#8872f8fc
机器人:endColor =#886dc0e3/>
< /形状>
< /剪辑>
< /项目>
<项目机器人:ID =@机器人:ID /进步>
<夹>
<形状>
<边角机器人:半径=5dip/>
<梯度
机器人:角=180
机器人:startColor =#31c6f7
机器人:centerColor =#2ea6d1
机器人:endColor =#2884a6/>
< /形状>
< /剪辑>
< /项目>
< /层列表>
解决方案
您可以用一个PNG图像发光的头。使用<位图>标记图层列表内,将其调整到合适的。我做了类似的事情,一个完全不同的应用程序
< XML版本=1.0编码=UTF-8&GT?;
<层列表的xmlns:机器人=http://schemas.android.com/apk/res/android>
<项目>
<形状>
<梯度
机器人:角=270
机器人:endColor =#4C4C4C
机器人:startColor =#303030/>
<中风
机器人:宽=0dp
机器人:颜色=#000000/>
<边角机器人:半径=0dp/>
<填充
机器人:底部=0dp
机器人:左=5DP
机器人:右=0dp
机器人:顶部=0dp/>
< /形状>
< /项目>
<项目>
<位图
机器人:反锯齿=真
机器人:重力=右|底部| fill_vertical
机器人:SRC =@可绘制/ spinner_down_arrow/>
< /项目>
< /层列表>
How to apply glow effect?
I am trying to create this type of horizontal ProgressBar
but no idea about the glowing effect for as starting point of progress.
Here is my code for gradient color
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape>
<corners android:radius="0dip" />
<solid android:color="#ff9d9e9d"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:angle="180"
android:startColor="#8872f8fc"
android:endColor="#886dc0e3" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:angle="180"
android:startColor="#31c6f7"
android:centerColor="#2ea6d1"
android:endColor="#2884a6" />
</shape>
</clip>
</item>
</layer-list>
解决方案
You can use a png image for glowing head. Use < bitmap> tag inside the layer-list and align it to right. I did a similar thing for a completely different application
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<gradient
android:angle="270"
android:endColor="#4C4C4C"
android:startColor="#303030" />
<stroke
android:width="0dp"
android:color="#000000" />
<corners android:radius="0dp" />
<padding
android:bottom="0dp"
android:left="5dp"
android:right="0dp"
android:top="0dp" />
</shape>
</item>
<item>
<bitmap
android:antialias="true"
android:gravity="right|bottom|fill_vertical"
android:src="@drawable/spinner_down_arrow" />
</item>
</layer-list>