无法扩展可绘制与ScaleDrawable [英] Unable to scale Drawable with ScaleDrawable

查看:198
本文介绍了无法扩展可绘制与ScaleDrawable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与ScaleDrawable不工作对我来说缩放。
提拉残留在相同的尺寸。

Scaling with ScaleDrawable is not working for me.
The drawable is remained in the same size.

LayerDrawable layerDrawable = new LayerDrawable(layers);        
Drawable d = layerDrawable.getCurrent();
ScaleDrawable sd = new ScaleDrawable(d, 0, 0.01f, 0.01f); 
return sd.getDrawable();

我需要做什么来解决呢?
谢谢你。

What i need to do to fix it?
Thanks.

推荐答案

您需要设置<一个href="http://developer.android.com/reference/android/graphics/drawable/Drawable.html#setLevel%28int%29"相对=nofollow>级别:

LayerDrawable layerDrawable = new LayerDrawable(layers);        
Drawable d = layerDrawable.getCurrent();
ScaleDrawable sd = new ScaleDrawable(d, 0, 0.01f, 0.01f); 
sd.setLevel(8000);
return sd;

该电平范围从0到10000:10000是全尺寸的,在0它不会出现在所有

The level ranges from 0 to 10000: at 10000 it is full size, at 0 it does not appear at all.

这篇关于无法扩展可绘制与ScaleDrawable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆