Android uses shape to present special effects on android Components

Source: Internet
Author: User





Layout file used

[Java]
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: orientation = "vertical"
Android: background = "# ffffff"
Android: gravity = "center_horizontal">
 
<TextView
Android: id = "@ + id/text"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: textColor = "#000000"
Android: text = "unused effects"
Android: layout_marginTop = "30dp"
/>
<EditText
Android: id = "@ + id/edit"
Android: layout_width = "280dp"
Android: layout_height = "wrap_content"
Android: textColor = "#000000"
Android: text = "effect not used effect"
Android: cursorVisible = "true"
/>
<TextView
Android: id = "@ + id/text"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: textColor = "#000000"
Android: text = "effects"
Android: layout_marginTop = "10dp"
/>
<EditText
Android: id = "@ + id/edit2"
Android: layout_width = "280dp"
Android: layout_height = "wrap_content"
Android: textColor = "#000000"
Android: text = "use effect"
Android: background = "@ drawable/shape"
Android: cursorVisible = "true"
/>

 
</LinearLayout>
Used shape File

[Java]
<? Xml version = "1.0" encoding = "UTF-8"?>
<Shape xmlns: android = "http://schemas.android.com/apk/res/android">
 
<Corners
Android: radius = "10dp"
/>
<Gradient
Android: startColor = "#33CC00"
Android: endColor = "#666600"
Android: angle = "45"
/>
<Padding
Android: left = "5dp"
Android: top = "5dp"
Android: right = "5dp"
Android: bottom = "5dp"
/>
<Stroke
Android: width = "3dp"
Android: color = "# FF3300"
/>

</Shape>

This section describes the functions of shape files.

Gradient mainly sets the background color gradient. StartColor indicates the starting color, endColor indicates the ending color, and angle indicates the gradient angle.

Padding mainly sets the distance between the content in the component and the border in the component.

Stroke mainly sets the widget border. Width indicates the Border width, and color indicates the border color.
 

 

From the Central-Perk Column

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: info-contact@alibabacloud.com 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.