これが古い投稿であることは知っていますが、ここで大いに役立つと思います。ドローアブルを使用する代わりに、ボタンを拡張してキャンバスに楕円形を描画してみてください。
ここに行きます:
public class YourButton extends Button {
//declare needed variables
private Context context;
private Paint ovalPaint;
public YourButton(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
private void init(Context context) {
this.context = context;
ovalPaint = new Paint();
ovalPaint.setAntiAlias(true);
ovalPaint.setStyle(Paint.Style.FILL);
ovalPaint.setColor(context.getResources().getColor(R.color.YOUR_RED_COLOR);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawOval(getOval(canvas), ovalPaint);
super.onDraw(canvas); //important
}
private RectF getOval(Canvas canvas) {
int offset = (int)(canvas.getWidth() * .05);
return new RectF(0 + offset, 0 + offset, canvas.getWidth() - offset, canvas.getHeight() - offset);
}
}
xml ファイルを次のように設定します。
<YourButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Text"
android:textSize="30sp"
android:textColor="#fff" />