【发布时间】:2016-04-28 21:31:54
【问题描述】:
这是我的非工作代码:
GradientDrawable sh = new GradientDrawable(); // create a gradient drawable.
Bitmap cbm = bmp.copy(Bitmap.Config.ARGB_8888, true); // do not use an immutable bitmap.
Canvas cv = new Canvas(cbm); //create a canvas using the mutable bitmap.
sh.setAlpha(255); // this has no effect?
sh.draw(cv); // does nothing?
sh.setStroke(thik, clr); //this works fine.
sh.setCornerRadius(radius); // This works fine.
v.setBackgroundDrawable(sh); // displays a rounded corner box with transparent center (no bitmap!!).
我确定我做错了什么,但我不知道我做错了什么。我希望这不是 Java 代码将简单的函数调用转换为带有要捕获的消息和填充的完整事件的另一种情况。
帮助?
基本上我需要的是一个按钮,它的角有点圆,笔画为 2 或 3 像素,中间有一个拉伸的位图(圆角应该覆盖位图的角)。
谢谢。
【问题讨论】: