Make View with rounded corners
suggest changeCreate a drawable file named custom_rectangle.xml in the drawable folder. The white stroke is the same color as the fill, so the border does not show:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@android:color/white" />
<corners android:radius="10dip" />
<stroke
android:width="1dp"
android:color="@android:color/white" />
</shape>
Now apply rectangle background on View:
mView.setBackgroundResource(R.drawable.custom_rectangle);
Reference screenshot:
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents