Android UI and Resources summary (i)

Source: Internet
Author: User

First, layout sets the dividing line, sets the divider for the linear layout

Configuration of the drawable

<?XML version= "1.0" encoding= "Utf-8"?><Shapexmlns:android= "Http://schemas.android.com/apk/res/android"Android:shape= "Rectangle">    <SolidAndroid:color= "@color/ui_default_divier_color"/>        <sizeAndroid:height= "1DP"Android:width= "1DP"/></Shape>

Layout inside the call situation:

Second, remove the ListView divider Line

1, set android:divider= "@null"

2, android:divider= "#00000000" #00000000后面两个零表示透明

3,. Setdividerheight (0) height set to 0

Thirdly, using String-array is a simple method of extracting XML resource file data.

Put the corresponding data in the values folder in the Strings.xml file, or other custom XML can be, the following methods are the same.

<?XML version= "1.0" encoding= "Utf-8"?> <Resources>     <String-arrayname= "Sports">       <Item>Football</Item>       <Item>Basketball</Item>       <Item>Hockey</Item>         </String-array> </Resources> 

Activity invocation:

String[] Sports=this.getresources (). Getstringarray (R.array.sports)

Iv. color and opacity (alpha) values in hexadecimal notation

The color and opacity (alpha) values are represented by hexadecimal notation. The range of values for any one color is 0 to 255 (00 to FF). For alpha,00, full transparency is expressed, and FF is completely opaque. The expression order is "Aabbggrr", where "Aa=alpha" (00 to FF); Bb=blue "(00 to FF); Gg=green "(00 to FF); Rr=red "(00 to FF). For example, if you want to apply a blue 50% opacity to an overlay, you should specify the following values: 7fff0000

The previous #ff0000 is six bits, and the six-bit front plus two bits represents the opacity (alpha) value.

Translucent: Button android:background= "#e0000000"

Transparent: Button android:background= "#00000000"

Java Code settings:

View v = Findviewbyid (r.id.content); Find the ID of the layout you want to set the transparent background to

V.getbackground (). Setalpha (100); 0~255 Transparency Value

V. Setting the configuration with rounded corners, borders, and backgrounds in drawable

<?XML version= "1.0" encoding= "Utf-8"?>    <Shapexmlns:android= "Http://schemas.android.com/apk/res/android">          <SolidAndroid:color= "@color/transparent" />//Background<CornersAndroid:topleftradius= "5DP"//Angle Android:toprightradius= "5DP"Android:bottomrightradius= "5DP"Android:bottomleftradius= "5DP"/>         <StrokeAndroid:width= "0.5DP"Android:color= "#c8c8c8" />//Border</Shape>   

Android UI and Resources summary (i)

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.