Android的:如何通过XML使圈,看起来像一个光环 [英] Android: How to make Circle through xml which looks like a halo
本文介绍了Android的:如何通过XML使圈,看起来像一个光环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让使用XML与晕圈。晕会像它开始用讲绿色的中心,绿颜色保持褪色,最后在边缘变得透明。
I am trying to make a circle using xml with a halo. The halo would be like it starts with say green color in the center, the greenish color keeps fading and finally at the edges it becomes transparent.
如何做呢?
我想使用下列内容:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient android:centerColor="@drawable/light_green" android:gradientRadius="250" android:type="radial"
android:endColor="@android:color/transparent"
android:angle="270"/>
</shape>
仍然没能得到预期的效果。任何铅将是有益的。
Still not able to get the desired effect. Any lead would be helpful.
推荐答案
试试这个:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<gradient
android:angle="270"
android:centerColor="#88FF0000"
android:centerX="50%p"
android:centerY="50%p"
android:endColor="#00FF0000"
android:gradientRadius="50%p"
android:startColor="#FFFF0000"
android:type="radial" />
<size
android:height="80dp"
android:width="80dp" />
</shape>
更改颜色code和改变centerColor的Alpha code按您的要求。
Change color code and change centerColor's alpha code as per your requirement
这篇关于Android的:如何通过XML使圈,看起来像一个光环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文