Drawing programmatically oval shape with border (corner radius) on Android
android, android-drawable, shapedrawable
Solution
this is a new solution:
RoundedBitmapDrawable RBD = RoundedBitmapDrawableFactory.create(mContext.getResources(),YourBitmap);
RBD.setCornerRadius(20);
RBD.setAntiAlias(true);
wholeRel.setBackground(RBD);
Problem
I`m trying to draw custom ShapeDrawable with OvalShape, filled with white and with grey border. I created a drawable like this: ``` ShapeDrawable drawable = new ShapeDrawable(new OvalShape()); drawable.getPaint().setColor(Color.GRAY); drawable.getPaint().setStyle(Style.STROKE); drawable.getPaint().setStrokeWidth(getPixels(5)); drawable.getPaint().setAntiAlias(true); ``` But the result of that was: corners problem The idea is programmatically to create a shape like this but with different colors: ``` <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <corners android:radius="10dip"/> <stroke android:color="#FF0000" android:width="5dip"/> <solid android:color="@android:color/transparent"/> </shape> ``` How can can be fix this?