Thoughts on Android (7): View class

Source: Internet
Author: User

Android recommends using an XML file to design the user interface, but virtually all components provide two ways to use it:

1. Set the xml genus in the XML layout file

2. Calling methods in Java program code


Android provides official documents that must be learned to use, can go to the official website, recommend a site, inside the document has a little (but not much) translation

Http://www.android-doc.com/reference/packages.html


The View class is the base class for all UI components and is used for all components:

XML properties

Related methods

Description

Android:accessibilityliveregion

setaccessibilityliveregion (int)

Whether the accessible service should automatically notify you of changes to the content description or text of the view, or the text description or text content of the child view (none--does not notify, polite--notice, assertive--interrupts the voice, and notifies)

Android:alpha

Setalpha (float)

Set the transparency of the component (0-1)

Android:background

Setbackgtoundresource (int)

Sets the background color of the component

Android:clickable

Setclickable (Boolean)

Sets whether the component can fire click events

Android:contentdescription

Setcontentdescription (charsequence)

Set content description information for a component

Android:drawingcachequality

setdrawingcachequality (int)

Set the quality of the drawing cache used by the component

Android:elevation

Setelevation (float)

Set the height of the component to float (5.0)

Android:fadingedge

Setverticalfadingenabled (Boolean)

Sets whether component boundaries use fade-out effects when scrolling the component

Android:fadingedgelength

Getverticalfadingedgelength

Set fade-out boundary length

Android:focusable

Setfocusable (Boolean)

Sets whether the component can get focus

Android:focusableintouchmode

Setfocusableintouchmode (Boolean)

Sets whether the component can get focus in touch mode

Android:id

SetId (int)

Sets the component's unique identifier, which can be obtained through Findviewbyid in Java code

Android:isscrollcontainer

Setscrollcontainer (Boolean)

Sets whether the component is used as a scrollable container

Android:keepscreenon

Setkeepscreenon (Boolean)

Sets whether the component will force the phone screen to remain open

Android:longclickable

Setlongclickable (Boolean)

Sets whether the component can respond to long click events

Android:layout_gravity

Sets the alignment of the component in its container

Android:layout_height

Setlayoutparams (Viewgroup.layoutparams params)

Sets the layout height of the component in its parent class container

Android:layout_width

Setlayoutparams (Viewgroup.layoutparams params)

Sets the layout width of the component in its parent container

Android:layout_margin

Sets the margins of the component when it is easy to layout in its parent class

Android:minheight

Setminimumheight (int)

Set the minimum height of the component

Android:minwidth

Setminimumwidth (int)

Sets the minimum width of the component

Android:nextfocusdown

Setnextfocusdownid (int)

Sets the component ID that focuses on the component and gets the focus when the down arrow is clicked

Android:nextfocusleft

Setnextfocusleftid (int)

Sets the component ID that focuses on the component and gets the focus when the left arrow is clicked

Android:nextfocusright

Setnextfocusrightid (int)

Sets the component ID that gets focus when the focus is on the component and left-click

Android:nextfocusup

Setnextfocusupid (int)

Sets the component ID that focuses on the component, and clicks the up arrow to get the focus

Android:onclick

Binding listeners for the component's Click events

Android:padding

Setpadding (Int,int,int,int)

To set the fill area on four sides of a component

Android:panddingbottom

Setpadding (Int,int,int,int)

Set the fill area below the component

Android:paddingleft

Setpadding (Int,int,int,int)

Set the fill area on the left side of the component

Android:paddingright

Setpadding (Int,int,int,int)

Set the fill area in the ZIP code of the component

Android:paddingtop

Setpadding (Int,int,int,int)

Set the fill area above the component

Android:rotation

Setrotation (float)

Set the angle of the component rotation

Android:rotationx

Setrotationx (float)

Sets the angle at which the component rotates around the x-axis

Android:rotationy

Setrotationy (float)

Sets the angle at which the component rotates around the y-axis

Android:saveenabled

Setsaveenabled (Boolean)

If set to false, then when the component is frozen the division does not save its state

Android:scalex

Setscalex (float)

Sets the scaling ratio of the component in the horizontal direction

Android:scaley

Setscaley (float)

Sets the scaling ratio of the component in the vertical direction

Android:scrollx

Horizontal scrolling offset after initialization of the component

Android:scrolly

Vertical scrolling offset after initialization of this component

Android:scrollbaralwaysdrawhoruzontrack

Sets whether the component always displays the track of the horizontal scroll bar

Android:scrollbaralwaydrawverticaltrack

Sets whether the component is always displayed on a track with a vertical scroll bar

Android:scrollbardefauitdelaybeforefade

Setscrollbardefauitdelaybeforefade (int)

Sets how many seconds the scrollbar is delayed before fading hidden hidden

Android:scrollbarfadeduration

setscrollbarfadeduration (int)

How many seconds does it take to set the scrollbar fade-out process

Android:scrollbarsize

setscrollbarsize (int)

Sets the width of the vertical scroll bar and the height of the horizontal scroll bar

Android:scrollbarstyle

Setscrollbarstyle (int)

Set the style and position of the scroll bar: insideoverlay/

Insideinset/outsideoverlay/outsideinset

Android:scrollbarthumbhorizontal

Sets the Drawable object for the slider of the component's horizontal scroll bar

Android:scrollbarthumbvertical

Sets the Drawable object for the slider of the component's vertical scroll bar

Android:scrollbartrackhorizontal

Sets the Drawable object corresponding to the track of the component's horizontal scroll bar

Android:scrollbartrackvertical

Drawable object that sets the track for the component's vertical scroll bar

Android:scrollbars

Sets the type of scroll bars displayed none/horizontal/vertical

Android:soundeffectsenabled

Setsoundeffectsenabled (Boolean)

Sets whether the component will use sound when clicked

Android:tag

Sets the tag value of a string type for the component, which can be obtained through the view's Gettag (), which can be found by Findviewwithtag ()

Android:textalignment

settextalignment (int)

Set the display alignment of text

Android:textdirection

settextdirection (int)

Set the direction in which text is displayed

Android:transformpivotx

Setpivotx (float)

Sets the x-coordinate of the center of rotation when the component rotates

Android:transformpivoty

Setpivoty (float)

Sets the y-coordinate of the center of rotation when the component rotates

Android:translationx

Settranslationx (float)

Sets the displacement of the component in the X direction

Android:translationy

Settranslationy (float)

Sets the displacement of the component in the Y direction

Android:translationz

Settranslationz (float)

Sets the displacement of the component in the z direction (5.0)

Android:visibility

setvisbility (int)

Sets whether the component is visible

Thoughts on Android (7): View class

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.