Android development skills 4-rounded controls to make it look more beautiful and android development skills
When you need to select a background for the application UI control, the developer adds custom colors and shapes to replace the system's default style,
The rounded border looks very good. Developers only need to add a few lines of code to use this effect in applications.
Let's take an example to create a new main. xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="50dp" android:background="@drawable/button_rounded_background" android:gravity="center_vertical" android:padding="10dp" android:text="Hello,RoundCornerDemo" android:textColor="#FFFFFF" /></LinearLayout>
The drawable value is specified for the background attribute, but this value is not an image but an xml file. The file code is as follows:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#02A712" /> <corners android:radius="15dp" /></shape>
Only two lines of code are supported. Let's take a look at the effect:
For example, the default founder style is more gentle and more elegant!
If you like it, follow me! Thank you for your support!