Android style and theme (1): android style theme

Source: Internet
Author: User

Android style and theme (1): android style theme

Main. the attributes defined by each component in xml code are duplicated. To avoid the hassle of defining repeated attributes of each component in a file: res/values/
Style_test.xml source code:

<? Xml version = "1.0" encoding = "UTF-8"?>
<Resources>
<Style name = "CodeFont" parent = "@ android: style/TextAppearance. Medium">
<Item name = "android: layout_width"> match_parent </item>
<Item name = "android: layout_height"> wrap_content </item>
<Item name = "android: textSize"> 16sp </item>
</Style>
</Resources>

Modify the main. xml file as follows:

<? Xml version = "1.0" encoding = "UTF-8"?>
<TableLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: stretchColumns = "1"
Android: background = "@ drawable/bluesky"
>

<! -- Account -->
<TableRow>
<TextView
Style = "@ style/CodeFont"
Android: text = "account :"
/>
<EditText
Style = "@ style/CodeFont"
Android: hint = "mobile phone number"
Android: selectAllOnFocus = "true"
/>
</TableRow>

<! -- Password -->
<TableRow>
<TextView
Style = "@ style/CodeFont"
Android: text = "Password :"
/>
<EditText
Style = "@ style/CodeFont"
Android: inputType = "numberPassword"
/>
</TableRow>

<! -- Birthday -->
<TableRow>
<TextView
Style = "@ style/CodeFont"
Android: text = "birthday :"
/>
<EditText
Style = "@ style/CodeFont"
Android: inputType = "date"
/>
</TableRow>

<! -- Address -->
<TableRow>
<TextView
Style = "@ style/CodeFont"
Android: text = "Address :"
/>
<EditText
Style = "@ style/CodeFont"
Android: inputType = "textPostalAddress"
/>
</TableRow>

<! -- Email -->
<TableRow>
<TextView
Style = "@ style/CodeFont"
Android: text = "Email :"
/>
<EditText
Style = "@ style/CodeFont"
Android: inputType = "textEmailAddress"
/>
</TableRow>

<! -- Register -->
<TableRow>
<Button
Style = "@ style/CodeFont"
Android: text = "register"
/>
</TableRow>

</TableLayout>

The running result is still.

 

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.