Android Control Property Manual

Source: Internet
Author: User

Control properties:

First Class: Property value is True or False
Android:layout_centerhrizontal Horizontal Center
Android:layout_centervertical Vertical Center
Android:layout_centerinparent is completely centered relative to the parent element
Android:layout_alignparentbottom snaps to the bottom edge of the parent element
Android:layout_alignparentleft snaps to the left edge of the parent element
Android:layout_alignparentright snaps to the right edge of the parent element
Android:layout_alignparenttop snaps to the top edge of the parent element
android:layout_alignwithparentifmissing if the corresponding sibling element cannot be found, then the parent element is the reference.

Second class: The attribute value must be the reference name of the id "@id/id-name"
Android:layout_below at the bottom of an element
Android:layout_above at the top of an element
Android:layout_toleftof on the left side of an element
Android:layout_torightof on the right side of an element
Android:layout_aligntop aligns the top edge of this element with the top edge of an element
Android:layout_alignleft aligns the left edge of this element with the left edge of an element
Android:layout_alignbottom aligns the bottom edge of this element with the bottom edge of an element
Android:layout_alignright aligns the right edge of this element with the right edge of an element

Class III: Attribute values are specific pixel values, such as 30dip,40px
Android:layout_marginbottom distance from the bottom edge of an element
Android:layout_marginleft distance from the left edge of an element
Android:layout_marginright distance from the right edge of an element
Android:layout_margintop distance from the top edge of an element

EditText the Android:hint setting EditText is empty when the message is in the input box.
The Android:gravity property is the qualification for the view content.  For example, a button above the text. You can set the text on the left side of the view, on the right, and so on. Take the button as an example, android:gravity= "right" then the text on the button
Android:layout_gravity is used to set the position of the view relative to the parent view. For example, a button in the LinearLayout, you want to put the button on the left, right and other positions can be set by this property. Take button For example, android:layout_gravity= "right" button on
Android:scaletype:
Android:scaletype is a size that controls how the picture resized/moved to the ImageView. The meaning difference of Imageview.scaletype/android:scaletype value:
Center/center is centered on the original size of the image, and when the picture is longer/wider than the length/width of the view, the center portion of the image is displayed
Center_crop/centercrop proportionally enlarges the size of the image so that the image is long (wide) equal to or greater than the length (width) of the view
Center_inside/centerinside Displays the contents of the picture in full, by scaling it down or the original size to make the picture long/wide equal to or less than the length/width of the view
Fit_center/fitcenter enlarge/Shrink the picture to the width of the view, centered on the display
Fit_end/fitend Zoom in/out to the width of the view, displayed in the lower part of the view
Fit_start/fitstart enlarge/Shrink the image to the width of the view, displayed in the upper part of the view
Fit_xy/fitxy The picture is not scaled up/down to the view size display
The Matrix/matrix is drawn with a matrix and is displayed by zooming in and out of the image.
* * To note that the Drawable folder inside the image name can not be capitalized.
--------------------------------------------------------------------------------------------------------------- ----------------------------------------------
ANDROID:BACKGROUND Specifies the background color used by the control, and the RGB naming method
Android:width the width of the specified control
Android:height the height of the specified control
Android:layout_weight a very important attribute in view, dividing the space proportionally
android:padding* Specifies the padding for the control, meaning that the contents of the control
Android:sigleline if set to True, the contents of the control are displayed in the same row
Android:paddingleft the distance of this element content from the right edge of this element
Android:paddingright the distance of this element content from the top edge of this element
--------------------------------------------------------------------------------------------------------------- --------------------------------------
Android:interpolator
There may be a lot of people don't understand its usage, the document is not very clear, in fact, very simple, see below: Interpolator defines the rate at which the change of an animation is made. This allows the basic animation effects (alpha, scale, translate, rotate) to be accelerated, slowed down, duplicated, etc. In a popular point of understanding is: the progress of the animation using Interpolator control. Interpolator defines the speed at which the animation changes, which can be achieved by constant velocity, positive acceleration, negative acceleration, irregular acceleration, and so on. Interpolator is a base class that encapsulates all interpolator common methods, and it has only one method, the getinterpolation (float input), which maps a point on the timeline to a M Ultiplier to is applied to the transformations of an animation. Android provides several interpolator subclasses that implement different speed curves, as follows:
Acceleratedecelerateinterpolator at the beginning of the animation and the introduction of the local rate change is slow, in the middle of the time to accelerate
Accelerateinterpolator at the beginning of the animation the rate change is slow, and then start to accelerate
Cycleinterpolator Animation Loop plays a specific number of times, rate changes along the sine curve
Decelerateinterpolator at the beginning of the animation the rate change is slow, and then start slowing down
Linearinterpolator changes at an even rate in the animation
For Linearinterpolator, the rate of change is a constant, i.e. f (x) = x.
public float getinterpolation (float input) {
return input;
}
Interpolator other sub-classes, are also in accordance with the specific algorithm, the realization of the rate of change. You can also define your own interpolator subclass to achieve the physical effects of parabolic and freefall.

TextView Property Summary
Android:autolink sets whether text is displayed as a clickable link when the text is a URL link/email/phone number/map. Selectable VALUES (None/web/email/phone/map/all)
Android:autotext if set, the spelling correction of the input values will be performed automatically. There is no effect here, it works when the input method is displayed and entered.
ANDROID:BUFFERTYPE Specifies the text category that is obtained by the GetText () method. The option editable is similar to the StringBuilder append character, which means that the Append method can be called to set the text content after gettext. Spannable can use the style in a given character area, see here 1, here 2.
Android:capitalize set the English letter capitalization type. There is no effect here, you need to pop up the input method to see, see EditView this property description.
Android:cursorvisible set cursor to show/hide, default display.
Android:digits sets which characters are allowed to be entered. such as "1234567890.+-*/% ()"
Android:drawablebottom output a drawable, slice below the text. If you specify a color, the background of text is set to that color, and the latter is overridden when used with background.
Android:drawableleft on the left side of the text output a drawable, slice.
Android:drawablepadding sets the spacing between text and drawable (picture), used with Drawableleft, Drawableright, Drawabletop, Drawablebottom, Can be set to negative, no effect is used alone.
Android:drawableright output a drawable to the right of text.
The android:drawabletop outputs a drawable directly above the text.
Android:editable whether the settings are editable.
Android:editorextras sets the additional input data for the text.
Android:ellipsize sets how the control is displayed when the text is too long. The following values are set: "Start"--the ellipsis is displayed at the beginning; End "--the ellipsis appears at the end; Middle "--the ellipsis appears in the middle; Marquee "--display in the form of a marquee (animated lateral movement)
Android:freezestext sets the contents of the saved text and the position of the cursor.
Android:gravity set the text position, as set to "center", the text will be centered.
Android:hinttext the text message that is displayed when empty, you can set the color of the hint information by Textcolorhint. This property is used in EditView, but can also be used here.
Android:imeoptions additional functions, set the action associated with the edit box in the lower right corner of the IME action, such as the lower right corner of the Actiondone will display a "done" instead of the default is a carriage return symbol. This is explained in detail in EditView, which is useless here.
Android:imeactionid Set the IME action ID.
Android:imeactionlabel Set the IME action label.
Android:includefontpadding sets whether the text contains extra white space at the top and bottom, which defaults to true.
ANDROID:INPUTMETHOD specifies the input method for text and requires a fully qualified name (the full package name). For example: Com.google.android.inputmethod.pinyin, but the error is not found here.
Android:inputtype sets the type of text that is used to help the input method display the appropriate keyboard type. Detailed in the EditView, there is no effect here.
Android:linksclickable sets whether the link clicks the connection, even if Autolink is set.
Android:marqueerepeatlimit sets the number of repetitions that are repeated when the ellipsize is specified marquee, when set to Marquee_forever.
Android:ems sets the width of the TextView to n characters. Test here for a Chinese character width
Android:maxems sets the width of the textview to a maximum of n characters. Overwrite EMS option when used with EMS.
Android:minems sets the width of the textview to a minimum of n characters. Overwrite EMS option when used with EMS.
Android:maxlength limits the length of text that is displayed, and the excess portion is not displayed.
Android:lines sets the number of lines of text, two lines are displayed, even if the second row has no data.
Android:maxlines sets the maximum number of lines of text to display, in combination with width or layout_width, beyond the partial wrap, and the number of lines beyond will not be displayed.
Android:minlines sets the minimum number of lines of text, similar to lines.
Android:linespacingextra sets the line spacing.
Android:linespacingmultiplier sets the multiple of line spacing. such as "1.2"
Android:numeric if set, the TextView has a digital input method. It is useless here, the only effect after setting is TextView has the click Effect, this property will be explained in detail in Edtiview.
Android:password with a small dot "." Display text
Android:phonenumber is set as the input for the phone number.
Android:privateimeoptions setting IME options is useless here, and will be discussed further in EditText.
android:scrollhorizontally if the text exceeds the width of the TextView, the horizontal pull bar appears.
Android:selectallonfocus If the text is selectable, let him get the focus instead of moving the cursor to the beginning or end of the text. No effect after setting in TextView.
ANDROID:SHADOWCOLOR Specifies the color of the text shadow, which needs to be used with Shadowradius.
ANDROID:SHADOWDX sets the start position of the shadow horizontal coordinates.
Android:shadowdy sets the start position of the shadow vertical coordinates.
Android:shadowradius sets the radius of the shadow. Set to 0.1 to become the color of the font, generally set to 3.0 effect is better.
Android:singleline sets the single-line display. If used with Layout_width, when the text cannot be displayed in its entirety, it is followed by "...". such as android:text= "Test_ Singleline"
Android:singleline= "true" android:layout_width= "20DP" will only show "t ...". If you do not set Singleline or set to False, the text wraps automatically
Android:textappearance to set the appearance of text. As "? Android:attr/textappearancelargeinverse" here refers to the system comes with a look,? Indicates whether the system has this appearance, otherwise use the default appearance. Can textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinverse/ Textappearancemedium/textappearancemediuminverse/textappearancesmall/textappearancesmallinverse
Android:textcolorhighlight the background of the selected text, the default is blue
Android:textcolorhint sets the color of the hint text, which is grayed out by default. Used in conjunction with hint.
Android:textcolorlink the color of the text link.
Android:textscalex set the spacing between text, which defaults to 1.0f.
Android:textsize set text size, recommended unit of measure "SP", such as "15SP"
Android:textstyle set glyph [Bold (bold) 0, Italic (italic) 1, bolditalic (coarse and oblique) 2] You can set one or more, with "|" Separated
Android:typeface Set the text font, must be one of the following constant values: normal 0, sans 1, serif 2, monospace (equal width font) 3]
Android:height Setting the height of the text area, support measurement: px (pixels)/dp/sp/in/mm (mm)
Android:maxheight Setting the maximum height of the text area
Android:minheight Setting the minimum height of the text area
Android:width sets the width of the text area, supported by the measurement: px (pixels)/dp/sp/in/mm (mm), and the difference between layout_width look here.
Android:maxwidth Setting the maximum width of the text area
Android:minwidth Setting the minimum width of the text area

Android Activity Properties Summary
Whether the android:allowtaskreparenting allows activity to replace dependent tasks, such as switching from a short message task to a browser task.
Android:alwaysretaintaskstate whether the state remains the same, such as switching back to home, then new open, the activity is in the final state
Android:cleartaskonlanunch such as P is activity, Q is triggered by P activity, and then back home, the new start P, whether to show Q
Android:configchanges whether the onconfigurationchanged () method such as "Locale|navigation|orientation" is called when the configuration list changes.
Android:enabled activity can be instantiated,
Whether the android:excludefromrecents can be displayed in the recently opened Activity list
Android:exported whether activity is allowed to be called by other programs
Android:finishontasklaunch whether to close open activity when the user restarts the task
Android:launchmode activity start mode, "standard" "Singletop" "Singletask" "SingleInstance" where the first two is a group, the latter two as a group
Android:multiprocess Allow multiple processes
Androidnhistory if the activity needs to be removed when the user switches to another screen. This attribute is introduced in API level 3.
Android:process
The name of the process in which the activity is run, and all program components run in the application's default process, which is the same name as the application's package name. The element in the process property can set a new default value for all components. But any component can override this default value, allowing you to put your program in a multi-process run. If this property is assigned the name begins with: When the activity is running, a new process dedicated to the program will be created. If the process name starts with a lowercase letter, the activity will run in the global process and be provided by its permission.
Android:screenorientation activity shows the mode, "unspecified" default value "Landscape" landscape mode, the width is larger than the height of the "portrait" portrait mode, height than the width of the larger. "User" users ' settings "behind" "Sensor" "Nosensor"
Android:statenotneeded whether activity is destroyed and successfully restarted does not save state
Android:taskaffinity activity's kinship, by default it has the same relationship as activity under an application
Android:theme activity's style theme, if not set, the activity's theme style belongs to the application, see element's Theme property
Android:windowsoftinputmode Activity main window and soft keyboard interaction mode, since API Level 3 was introduced
How the active main window interacts with the Soft keyboard window on the containing screen. The setting of this property will affect two things:
1> the state of the soft keyboard-whether it is hidden or displayed-when the activity becomes the focus of the user's attention.
2> Active main Window adjustment-whether to reduce the active main window size to make room for a soft keyboard or whether the current focus of its content is visible when part of the active window is overwritten by a soft keyboard.
It must be set to a value in the list below, or a "state ..." value plus a combination of "adjust ..." values. Set multiple values in either group-multiple "state ..." values, such as &mdash, have undefined results. Each value is separated by | Example: <activity android:windowsoftinputmode= "Statevisible|adjustresize" ... >
The value set in this (except "stateunspecified" and "adjustunspecified") overrides the value set in the topic
Value Description:
The state of the "stateunspecified" soft keyboard (whether it is hidden or visible) is not specified. The system will select an appropriate state or a theme-dependent setting. This is the default setting for the software disk behavior.
The "stateunchanged" soft keyboard is maintained regardless of its last state, whether visible or hidden, when the main window appears in front.
"Statehidden" When the user chooses the activity, the soft keyboard is hidden-that is, when the user determines to navigate to the activity, instead of returning to it due to leaving another activity.
The "Statealwayshidden" soft keyboard is always hidden when the activity main window gets focus.
The "statevisible" soft keyboard is visible when that is normal (when the user navigates to the Activity main window).
"Statealwaysvisible" When the user chooses this activity, the soft keyboard is visible-that is, when the user determines that the activity is navigated to, rather than returning to it due to leaving another activity.
"Adjustunspecified" It is not specified whether the Activity main window is resized to allow space for the soft keyboard, or whether the contents of the window are visible on the screen with the current focus. The system will automatically select one of these modes primarily depending on whether the contents of the window have any layout view that can scroll their content. If there is such a view, the window will be resized so that the contents of the scrolling window can be visible in a smaller area. This is the default behavior setting for the main window.
"Adjustresize" The activity main window is always resized on the screen to allow space for the soft keyboard.
"Adjustpan" The Activity main window does not adjust the size of the screen to allow space for the soft keyboard. Instead, the contents of the current window are automatically moved so that the current focus is never covered by the keyboard and the user can always see the part of the input. This is usually not expected than resizing, because the user may turn off the soft keyboard in order to get an interactive operation with the covered content.

Android EditText Properties Summary
The android:numeric= "integer" setting can only enter integers, if it is a decimal: decimal
Android:singleline= "True" sets the single-line input, and once set to true, the text does not wrap.
Android:password= "true" setting can only enter password
android:textscalex= "1.5" controls the spacing between words and words
Android:typeface= "Monospace"
Font, normal, sans, serif, monospace
android:background= "@null" space background, not here, refers to transparent
android:layout_weight= "1" weights, which control the position between controls, are useful when controlling the size of the control display.
Android:textappearance= "? Android:attr/textappearancelargeinverse"
Text appearance, which refers to the system comes with a look,? Indicates whether the system has this appearance, otherwise the default appearance is used. I don't know if I understand that, right?

Implemented by edittext the relevant properties in the layout XML file:
1. The Password Box property android:password= "True" allows the EditText to be displayed automatically as an asterisk, and the content will be changed to * within 1 seconds.
2. Pure Digital android:numeric= "true" This allows the input method to automatically become a digital input keyboard, while allowing only 0-9 of the digital input
3. Allow only android:capitalize= "cwj1987" to accept input cwj1987 only, generally for password authentication
Tablelayout
android:stretchcolumns= "0" The first column fills the entire row as an extruded column

Android Control Property Manual

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.