Some methods and properties of Android

Source: Internet
Author: User

1.Activity Common methods
View Findviewbyid (int id)//Get Component Object based on component ID
Setcontentview (int layoutresid)//Set layout file, set display component


2.TextView
Android:maxlength= "6"//maximum number of characters allowed
Android:textcolor= "#FF0000"//Color of text
Android:textsize= "50px"//Size of text
Android:textstyle= "Bold"//Text style
Android:password= "true"//whether it is displayed in ciphertext mode
android:layout_margin= "50px"//Margin
android:background= "@drawable/P"//Background
android= value of "@+id/id value"//Setting ID

GetText (). toString ();//Get the text content of the control
SetText ();//Set the text content of the control
Note:<!----;: Notes


3.Button


4.EditText
Android:enabled= "false"//setting is available, false not used

<?xml version="1.0"encoding="Utf-8"? ><linearlayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="Vertical"Android:layout_width="fill_parent"Android:layout_height="fill_parent"> <!--<TextView Android="@+id/tv"Android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:text="Second123"Android:maxlength="6"Android:textcolor="#FF0000"android:textsize="50px"Android:textstyle="Bold"Android:password="true"Android:layout_margin="50px"Android:background="@drawable/P"/>-<!--prefix: prefix--<TextView Android="@+id/tv2"Android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:text="Second123"Android:maxlength="9"Android:textcolor="#00FF00"android:textsize="50px"Android:textstyle="Bold"Android:password="true"/><Button android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:text="Button"Android:textcolor="#FF0000"/><EditText android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:text="I'm a good guy ."android:enabled="false"/></linearlayout>
Sample Code

Some methods and properties of Android

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.