我使用canvas和bitmap来创建图像。 我在ScrollView(600x400)中添加我的图像。
int width = 2048;
int height = 600;
ImageView myImage = new ImageView(context);
Bitmap bitmapChart = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888);
Canvas canvasChart = new Canvas(bitmapChart);
var paint = new Paint();
paint.Color = Color.Red;
paint.SetStyle(Paint.Style.Fill);
Rect rect = new Rect(0, 0, width, height);
canvasChart.DrawRect(rect, paint);
myImage.SetImageBitmap(bitmapChart);
HorizontalScrollView scrollView1 = new HorizontalScrollView(context);
scrollView1.LayoutParameters.Height = 400;
scrollView1.LayoutParameters.Width = 600;
scrollView1.AddView(myImage);
this.AddView(scrollView1);
但如果我的图像宽度为2049或更高,则此图像不会显示在平板电脑上(在模拟器上它可以正常工作)。
为什么我看不到自己的形象?