内容简介:http://stackoverflow.com/questions/8501599/radial-gradient-for-different-dpi
我正在创建一个径向渐变,如:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#7faacaFF" android:endColor="#cfe1edFF" android:gradientRadius="326" android:type="radial"/> </shape>
但是在gradientRadius字段中,使用像sp和dip这样的值返回一个错误.
有没有办法为mdpi指定半径和比例,并在其余屏幕密度中自动缩放,还是需要创建多个可绘制的文件?
那么如果你这样做:
RES /抽拉/ foo.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#7faacaFF" android:endColor="#cfe1edFF" android:gradientRadius="@dimen/radius" android:type="radial"/> </shape>
RES /值-MDPI / dimens.xml
<resources ...> ... <item name="radius" format="float" type="dimen">326</item> .... </resources>
RES /值-HDPI / dimens.xml
<resources ...> ... <item name="radius" format="float" type="dimen">200.34</item> .... </resources>
你怎么看?
http://stackoverflow.com/questions/8501599/radial-gradient-for-different-dpi
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- iOS WHGradientHelper(线性、径向渐变;渐变动画;Lable字体渐变及动画)
- CSS3径向渐变radial-gradient实现波浪边框和内倒角
- Flutter 中渐变的高级用法
- 沉浸式渐变图片轮播器
- CSS3 渐变(Gradients)
- 简易的iOS导航栏颜色渐变方案
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Collective Intelligence实战
阿拉克 / 2010-9 / 58.00元
《Collective Intelligence实战》内容简介:在互联网上,利用用户的集体智慧是成功的关键。集体智慧是一种新兴的编程技术,可让您从人们访问web和与web交互的过程中找到有价值的模式、发现这些访问者之间的关系和确定他们的个人偏好及习惯等。《collective Intelligence实战》首先介绍了集体智慧的原则和构建更具交互性网站的思想,然后通过示例开发了一个直接可用的基于Ja......一起来看看 《Collective Intelligence实战》 这本书的介绍吧!
HTML 压缩/解压工具
在线压缩/解压 HTML 代码
UNIX 时间戳转换
UNIX 时间戳转换