テキストを下中央に配置する方法
私の実装
@Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
//strokePaint.setTextAlign(Paint.Align.CENTER);
strokePaint.setTextSize(20);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(5);
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
//textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, strokePaint);
canvas.drawText("Some Text", 100, 100, textPaint);
}
<ImageView
android:id="@+id/myImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_1" />
<vbright.usanin.salesRegion.Text.TextViewOutline
android:id="@+id/myImageViewText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/myImageView"
android:layout_alignLeft="@+id/myImageView"
android:layout_alignRight="@+id/myImageView"
android:layout_alignTop="@+id/myImageView" />