Rounded Corners with a Border

Stroke it.

Rounded Corners with a Border

In this Android tutorial, we'll create rounded corners with a stroke -- or border. The finished code looks like this:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="24dp" />
    <solid android:color="#9C27B0" />
    <stroke
        android:width="4dp"
        android:color="#000" />
</shape>

We need to add a radius to make the corners rounded, solid to set the background color, and stroke to set the border width and color.

The finished work looks like this:

More Tutorials

Android Basic Alert Dialog Box
Basic CardView

Basic CardView

Material Design.

Rounded Corners with a Border
Rounded Button in Android Studio

Rounded Button in Android Studio

Create beautiful buttons in XML.

RecyclerView Day 3: Invoicing app

RecyclerView Day 3: Invoicing app

Built with Android Studio and Kotlin.

Build a Ridesharing Android App - Part 1

Build a Ridesharing Android App - Part 1

Getting started is sometimes the hardest part.

setOnClickListener

Add a click listener in Kotlin.

Android Login Layout

Let users sign in.

Registration Screen

Registration Screen

It always begins with registration.