我想插入一个图像静态图像(soemthing像一个帧内的图像)。我可以在一定程度上得到它,但不能把它正确地放在给定的图像中。插入图像给出一个图像在android
橙色边框是需要动态插入地图中标记的框架和占位符。
这是我曾尝试:
Bitmap pic = BitmapFactory.decodeResource(getResources(),
R.drawable.bluepic);
Bitmap orangeframe = BitmapFactory.decodeResource(getResources(),R.drawable.orangeborder);
Bitmap out = combineImages(orangeframe, pic);
public Bitmap combineImages(Bitmap frame, Bitmap image)
{
Bitmap cs = null;
Bitmap rs = null;
rs = Bitmap.createScaledBitmap(frame, image.getWidth(),
image.getHeight(), true);
cs = Bitmap.createBitmap(rs.getWidth(), rs.getHeight(),
Bitmap.Config.RGB_565);
Canvas comboImage = new Canvas(cs);
comboImage.drawBitmap(image,0, 0, null);
comboImage.drawBitmap(rs, 0, 0, null);
if (rs != null) {
rs.recycle();
rs = null;
}
Runtime.getRuntime().gc();
return cs;
}
我得到这个:
的占位符是动态的,ORAGE帧图像是静止的。我想以编程方式直接在橙色图像中插入图像。
这可能吗?
我想你想实现的东西在恶劣的方式简单。我宁愿使用两个不同的ImageView。第一个包含占位符作为src和圆角平方的边框作为背景。第二个只包含钩子。 – Blackbelt 2014-09-19 08:01:14
@blackbelt:问题是我正在将这个标记应用到地图上。哪一个正在寻找一个位图。因此我不能将它应用于imageView。对不起,我应该写下我正在努力做的事情。 – TheDevMan 2014-09-19 08:04:06
地图只占用位图作为占位符?没有意见?这不好。在这种情况下,我将使用placehoder的位图和绘制边界的路径 – Blackbelt 2014-09-19 08:07:21