Düzenleme
DiamondTextView
gibi bir java sınıfında aşağıdaki kodu yerleştirin:
public class DiamondTextView extends TextView{
public DiamondTextView(Context ctx, AttributeSet attrs) {
super(ctx, attrs);
}
Paint mBorderPaint = new Paint();
@Override
protected void onDraw(Canvas canvas) {
mPath.moveTo(mWidth/2 , 0);
mPath.lineTo(mWidth , mHeight/2);
mPath.lineTo(mWidth /2 , mHeight);
mPath.lineTo(0 , mHeight/2);
mPath.lineTo(mWidth/2 ,0);
//setup the paint for fill
mBorderPaint.setAlpha(255);
mBorderPaint.setColor(mBorderColor);
mBorderPaint.setStyle(Paint.Style.FILL);
borderPaint.setStrokeWidth(mBorderWidth);
//draw it
canvas.drawPath(mPath ,mBorderPaint);
//setup the paint for stroke
mBorderPaint.setAlpha(51);
mBorderPaint.setStyle(Paint.Style.STROKE);
//draw it again
canvas.drawPath(mPath ,mBorderPaint);
super.onDraw(canvas);
}
}
ve bu TextView'un kullanmak istediğiniz yerde olarak diyoruz: Daha fazla bilgi için
<com.erginus.ABC.Commons.DiamondTextView...../>
bilgi burada bakınız: http://developer.android.com/reference/android/graphics/drawable/shapes/PathShape.html
Aşağıdaki kütüphaneyi de kullanabilirsiniz: https://github.com/siyamed/android-shape-imageview
@PhilTheThrill Teşekkürler ve sizin için yararlı olup olmadığını söyleyin. –
Bu sadece arka planı çizecek, metni sınırlamayacaktır. – ElDuderino
@ElDuderino Evet ve bir arka plan olarak ayarlamanız gerekiyor. –