我正在开发一款安卓应用程序,我想在视图中的特定位置放置一个ImageView
。为此,我使用了以下代码并成功地实现了:
ImageView image = (ImageView) findViewById(R.id.imageView1);
Bitmap bMap = BitmapFactory.decodeResource(getResources(), R.drawable.mrng);
Matrix mat = new Matrix();
mat.postRotate(350);
Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(),bMap.getHeight(), mat, true);
image.setImageBitmap(bMapRotate);
现在我想给这张图片加上边框。我已经制作了一个形状的xml,并将其设置为图像视图的背景。
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<stroke android:width="3dp" android:color="#000000" />
</shape>
但是当我为图像视图设置背景形状时,它没有给出正确的输出。请帮帮我。
我不想要ImageView周围的边框,而是想要旋转图片周围的边框。
android:cropToPadding
。 - Aleks Gpaint.setAntiAlias(true);
但边框仍然看起来很粗糙,有没有解决办法? - Vivek Thummar