0
我想在图像上绘制矩形,并且无法将图像放置在图像上。只有部分矩形显示在屏幕底部的某处。下面是我在做什么:调整位图画布的大小
正弦波是从水库图像>绘制文件夹
public void onDraw(Canvas canvas)
{
Bitmap myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.sinewave);
canvas.drawBitmap(myBitmap, 0, 0, null);
Paint myPaint = new Paint();
myPaint.setColor(Color.GREEN);
myPaint.setStyle(Paint.Style.STROKE);
myPaint.setStrokeWidth(3);
canvas.drawRect(0, 35 ,80 , 20, myPaint);
}
我没有能够超越35,我要放置矩形权正弦波的图像的中间。有人能帮助我解决他们的想法吗?
如何使用视图绘制图像,然后移动其坐标,然后在其上绘制另一个视图。 PLease帮助我,我是新的Android图形。我知道以下。 ImageView i = new ImageView(this); i.setImageResource(R.drawable.my_image); i.setAdjustViewBounds(true); //设置ImageView边界与Drawable的尺寸匹配 i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); – 2010-08-06 18:53:32
对不起,我不确定那个。我不是与android布局最大的。我刚刚处理了一些画布和位图代码,所以我想我会尽力提供帮助。您可以尝试发表该评论作为获得更多回复的另一个问题。另外,看看api演示项目的想法。 – 2010-08-06 22:43:58
[shelfs](http://code.google.com/p/shelves/)项目也有一些很棒的绘图/布局代码。 – 2010-08-06 22:44:31