Android development skills 4-rounded controls to make it look more beautiful and android development skills

Source: Internet
Author: User

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=""    xmlns: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="" >    <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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.