0
我使用下面的代码获得可绘制的完美效果,但高度和宽度在所有屏幕上不同,我如何获得常用高度(大小= 34)和宽度(大小= 34)适用于所有设备。Android适用于所有分辨率的常见高度和宽度
public Drawable getDrawable(String source) {
int height = 34,
width = 34;
LevelListDrawable d = new LevelListDrawable();
int id = _context.getResources().getIdentifier(source, "drawable", _context.getPackageName());
Drawable empty = _context.getResources().getDrawable(id);
d.addLevel(0, 0, empty);
d.setBounds(0, 0, height, width);
return d;
}
谢谢你的工作...... –