Create beautiful buttons in XML.
Creating rounded corners on Button
's is easy with Android Studio. Follow this tutorial as a guide. First, right click on the drawable
folder on the left side of Android Studio, then select New
then Drawable resource file
.
File name can be rounded_corners
. Then press Ok.
You should then be presented with your file titled rounded_corners.xml
. This is what it will look like:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>
We need to edit this file. Replace this file with the following.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="24dp" />
<solid android:color="#F00" />
</shape>
Open the Preview pane on the right side of the screen, and you should see a preview of the rounded corners with a red background.
To actually use this file, open content_main.xml
(or whatever your layout file is) and add a background
of the new rounded corners:
<Button
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_margin="40dp"
android:background="@drawable/rounded_corners"
android:text="Rounded Buttons"
android:textColor="#FFF"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
That's it!
Alert tutorial.
Material Design.
Stroke it.
Create beautiful buttons in XML.
Built with Android Studio and Kotlin.
Getting started is sometimes the hardest part.
Add a click listener in Kotlin.
Let users sign in.
It always begins with registration.