بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
ترسیم دایره روی عکس
برای این سوال 2 پاسخ وجود دارد.
پاسخ به سوال
سپهر
11 سال پیش
+7
0
اومدم 3 تا عکس رو روی هم قرار دادم
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/background"
android:layout_width="49dip"
android:layout_height="49dip"
android:background="#FF0000"/>
<ImageView
android:id="@+id/achievementlogo"
android:layout_width="50dip"
android:layout_height="50dip"
android:scaleType="fitCenter"
android:src="@drawable/medal" />
<ImageView
android:id="@+id/canvaslayer"
android:layout_width="50dip"
android:layout_height="50dip"
android:scaleType="fitCenter"
android:src="@drawable/profile" />
<ImageView
android:id="@+id/maskimage"
android:layout_width="50dip"
android:layout_height="50dip"
android:scaleType="fitCenter"
android:src="@drawable/mask" />
</RelativeLayout>
بعد توی کد جاوام هم تابع زیر رو تعریف کردم :
private void createBitMap() {
// Create a mutable bitmap
Bitmap bitMap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
bitMap = bitMap.copy(bitMap.getConfig(), true);
// Construct a canvas with the specified bitmap to draw into
Canvas canvas = new Canvas(bitMap);
// Create a new paint with default settings.
Paint paint = new Paint();
// smooths out the edges of what is being drawn
paint.setAntiAlias(true);
// set color
paint.setColor(0x000000);
// set style
paint.setStyle(Paint.Style.FILL_AND_STROKE);
// set stroke
paint.setStrokeWidth(4.5f);
//set alpha
paint.setAlpha(0x90);
RectF rectF = new RectF(0, 0, 100, 100);
canvas.drawArc(rectF, (70 * 360 / 100) - 90, 360 - (70 * 360 / 100), true, paint);
// set on ImageView or any other view
ImageView imageView = (ImageView) findViewById(R.id.canvaslayer);
imageView.setImageBitmap(bitMap);
}
پاسخ به سوال
سپهر
11 سال پیش
0
0
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .
