Android. View. View
Known direct subclass:
Analogclock, imageview, keyboardview, progressbar, surfaceview, textview, viewgroup, viewstub
Known indirect subclass:
Abslistview, absseekbar, absspinner, vertex, adapterview <t extends adapter>, appwidgethostview, autocompletetextview, button, checkbox, checkedtextview, chronometer, distance, datepicker, dialerfilter, digitalclock,
Edittext, plain, extractedittext, framelayout, glsurfaceview, gallery, gestureoverlayview, gridview, examples, imagebutton, imageswitcher, linearlayout, listview, mediacontroller, example, example, radiobutton,
Radiogroup, ratingbar, metrics, scrollview, seekbar, metrics, spinner, tabhost, tabwidget, metrics, tablerow, textswitcher, metrics, togglebutton, metrics, videoview, viewanimator, metrics, viewswitcher, webview, zoombutton,
Zoomcontrols
XML attributes
Attribute name |
Description |
Android: Background |
Set the background color/background image. You can set the background to transparent in either of the following ways: "@ Android: color/transparent" and "@ null ". Note that textview is transparent by default. You do not need to write this attribute, but you have to write this attribute if you want to make it transparent. |
Android: clickable |
Whether to respond to click events. |
Android: contentdescription |
Set the description of view remarks, which is provided as an auxiliary function and provides descriptions for views without text descriptions, such as imagebutton. There is no effect on the interface. You can control it in the program and temporarily put a little string of data. |
Android: drawingcachequality |
Sets the translucent quality when drawing. You can set the following values: auto (default, determined by the Framework)/high (high quality, high color depth, more memory consumption)/low (low quality, uses a lower color depth, but uses less memory ). |
Android: duplicateparentstate |
If this attribute is set, the drawing status (cursor, press, etc.) is obtained directly from the parent container ). See the code section below. Note that the current test is only to get the drawing status, but not to get the event. That is, when you click linearlayout, the button has the effect of being clicked, but does not execute the click event. |
Android: fadingedge |
Set the orientation of the border gradient when you pull the scroll bar. None (border color unchanged), horizontal (horizontal color fades), vertical (vertical color fades ). Refer to |
Android: fadingedgelength |
Set the length of the border gradient. |
Android: fitssystemwindows |
Whether to consider the system window (such as the status bar) when setting Layout Adjustment) |
Android: focusable |
Set whether to obtain the focus. If requestfocus () is called, the latter takes priority. Note: If you want to set a focal point for an edittext file in the form, you cannot set the light to false. You must set the focusable In Front Of The edittext file to false. To obtain the focus in touch mode, you must set focusableintouchmode to true. |
Android: focusableintouchmode |
Set whether the view can get the focus in touch mode. |
Android: hapticfeedbackenabled |
Set whether to accept other touch feedback events on time. Here, the simulator has not tried the effect. Is it a multi-point touch? If you cannot find any information, you can find information about the keyword "performhapticfeedback" or "hapticfeedback. |
Android: ID |
Set a unique ID for the current view in layout. xml. You can find the corresponding view by calling view. findviewbyid () or activity. findviewbyid. Different layout. XML definitions of the same Id do not conflict. Format: @ + ID/btnname" |
Android: isscrollcontainer |
Set the current view as a rolling container. The result is not tested here. You do not need to set this attribute at all for listview/gridview/scrollview, and for edidtext, Android: scrollbars can also get a scroll bar. |
Android: keepscreenon |
Whether the view remains awake when it is visible. This attribute is often used in linearlayout, but it does not work in the simulator. |
Android: longclickable |
Set whether to respond to the long press event. |
Android: minheight |
Set the minimum view height |
Android: minwidth |
Sets the minimum width of a view. |
Android: nextfocusdown |
Set the following view to get the next focus. Focus movement is based on an algorithm for finding nearest neighbor in a given direction. If the specified view does not exist, a running error is reported when you move the focus. You can set imeoptions = actiondone so that the input will jump to the next focus. |
Android: nextfocusleft |
Set the specified view on the left to get the next focus. |
Android: nextfocusright |
Set the specified view on the right to get the next focus. |
Android: nextfocusup |
Set the top view to get the next focus. |
Android: onclick |
The specified method is called from the context when you click. Specify a method name. Generally, the activity defines a function that complies with the following parameters and return values, and specifies the method name string as the value: Public void onclickbutton (view) Android: onclick = "onclickbutton" |
Android: padding |
Set the margin between top, bottom, and left to fill the white space in pixels. |
Android: paddingbottom |
Set the padding at the bottom to fill the white space in pixels. |
Android: paddingleft |
Set the left margin to fill the white space in pixels. |
Android: paddingright |
Set the margin on the right to fill the white space in pixels .. |
Android: paddingtop |
Set the margin above to fill the white space in pixels. |
Android: saveenabled |
Set whether to save the View data when the window is frozen (such as rotating the screen). The default value is true, but only when you need to set the ID for automatic saving, see here. |
Android: scrollx |
Set the offset value for horizontal scrolling in pixels. This effect can be seen in the gridview. |
Android: scrolly |
Sets the offset value for vertical scrolling in pixels. |
Android: scrollbaralwaysdrawhorizontaltrack |
Sets whether the vertical scroll bar is always displayed. Scrollview and listview test are ineffective here. |
Android: scrollbaralwaysdrawverticaltrack |
Sets whether the vertical scroll bar is always displayed. Scrollview and listview test are ineffective here. |
Android: scrollbardefadeldelaybeforefade |
Starts to fade after setting n milliseconds, in milliseconds. |
Android: scrollbarfadeduration |
Set the time for the scroll bar to fade out (from the beginning to the end), in milliseconds. In android2.2, the scroll bar disappears after being rolled, and then appears again. It is displayed in versions 1.5 and 1.6. |
Android: scrollbarsize |
Set the width of the scroll bar. |
Android: scrollbarstyle |
Set the style and position of the scroll bar. Set values: insideoverlay, insideinset, outsideoverlay, and outsideinset. There are not too many results. The following is a comparison between outsideoverlay and outsideinset: |
Android: scrollpolicumbhorizontal |
Set the drawable (such as color) of the horizontal scroll bar ). |
Android: scrollpolicumbvertical |
Set the drawable (such as color) of the vertical scroll bar ). |
Android: scrollbartrackhorizontal |
Set the color drawable (such as color) of the horizontal scroll bar background (track) |
Android: scrollbartrackvertical |
Set the drawable of the vertical scroll bar background (track). Note that setting the color value directly, for example, "Android: color/White", will produce a very ugly effect, and even do not understand this attribute, see Res/drawable/scrollbar_vertical_thumb.xml and scrollbar_vertical_track.xml in apidemos. Set the code to Android: scrollbartrackvertical = "@ drawable/scrollbar_vertical_track" |
Android: scrollbars |
Set the display of the scroll bar. None (hidden), horizontal (horizontal), vertical (vertical ). See the following code to demonstrate how to use this attribute to enable a scroll bar in edittext. However, other containers, such as linearlayout, are set but have no effect. |
Android: soundeffectsenabled |
Set whether there is sound effect when you click or touch |
Android: Tag |
Set a text tag. You can use view. gettag () or for with view. findviewwithtag () to retrieve the view containing the tag string. However, it is generally better to query the view by ID because it is faster and supports type check during compilation. |
Android: visibility |
Set whether to display the view. Set Value: visible (default value, display), invisible (not displayed, but still occupied space), and gone (not displayed, not occupied space) |
XML attributes
Attribute Name Description
Android: Background: sets the background color/background image. You can set the background to transparent in either of the following ways: "@ Android: color/transparent" and "@ null ". Note that textview is transparent by default. You do not need to write this attribute, but you have to write this attribute if you want to make it transparent.
Android: whether clickable responds to click events.
Android: contentdescription sets the description of the view, which is provided as an auxiliary function. It provides instructions for views without text descriptions, such as imagebutton. There is no effect on the interface. You can control it in the program and temporarily put a little string of data.
Android: drawingcachequality: sets the translucent quality when drawing. You can set the following values: auto (default, determined by the Framework)/high (high quality, high color depth, more memory consumption)/low (low quality, uses a lower color depth, but uses less memory ).
Android: duplicateparentstate if this attribute is set, the drawing status (cursor, press, etc.) is obtained directly from the parent container ). See the code section below. Note that the current test is only to get the drawing status, but not to get the event. That is, when you click linearlayout, the button has the effect of being clicked, but does not execute the click event.
Android: When fadingedge is set to pull the scroll bar, the border gradient is displayed. None (border color unchanged), horizontal (horizontal color fades), vertical (vertical color fades ). Refer to
Android: fadingedgelength: Set the length of the border gradient.
Android: fitssystemwindows: whether to consider the system window (such as the status bar) when setting Layout Adjustment)
Android: Set whether to obtain the focus. If requestfocus () is called, the latter takes priority. Note: If you want to set a focal point for an edittext file in the form, you cannot set the light to false. You must set the focusable In Front Of The edittext file to false. To obtain the focus in touch mode, you must set focusableintouchmode to true.
Android: focusableintouchmode: sets whether the view can gain focus in touch mode.
Android: hapticfeedbackenabled: Specifies whether to accept other touch feedback events on time. Here, the simulator has not tried the effect. Is it a multi-point touch? If you cannot find any information, you can find information about the keyword "performhapticfeedback" or "hapticfeedback.
Android: Id sets a unique ID for the current view in the current layout. xml. You can find the corresponding view by calling view. findviewbyid () or activity. findviewbyid. Different layout. XML definitions of the same Id do not conflict. Format: @ + ID/btnname"
Android: isscrollcontainer sets the current view as a rolling container. The result is not tested here. You do not need to set this attribute at all for listview/gridview/scrollview, and for edidtext, Android: scrollbars can also get a scroll bar.
Android: keepscreenon view: whether to stay awake when visible.
This attribute is often used in linearlayout, but it does not work in the simulator.
Android: longclickable sets whether to respond to the long-press event.
Android: minheight: sets the minimum view height.
Android: minwidth: sets the minimum width of a view.
Android: nextfocusdown: Set the specified view below to get the next focus. Focus movement is based on an algorithm for finding nearest neighbor in a given direction. If the specified view does not exist, a running error is reported when you move the focus. You can set imeoptions = actiondone so that the input will jump to the next focus.
Android: nextfocusleft: Specifies the view on the left to get the next focus.
Android: nextfocusright: Specifies the view on the right to get the next focus.
Android: nextfocusup: Specifies the view above the settings to get the next focus.
Android: When onclick is clicked, the specified method is called from the context. Specify a method name. Generally, the activity defines a function that complies with the following parameters and return values, and specifies the method name string as the value:
Public void onclickbutton (view)
Android: onclick = "onclickbutton"
Android: padding sets the padding between top, bottom, and left. The padding is filled in pixels.
Android: paddingbottom sets the bottom margin to fill the white space in pixels.
Android: paddingleft is used to set the left margin and fill the white space in pixels.
Android: paddingright: Set the margin on the right to fill the white space in pixels ..
Android: paddingtop: Set the top margin to fill the white space in pixels.
Android: saveenabled sets whether to save the View data when the window is frozen (such as rotating the screen). The default value is true, but the premise is that you need to set the ID to automatically save the View data. See here.
Android: scrollx sets the offset value for horizontal scrolling in pixels. This effect can be seen in the gridview.
Android: scrolly sets the offset value for vertical scrolling in pixels
Android: scrollbaralwaysdrawhorizontaltrack sets whether the vertical scroll bar is always displayed. Scrollview and listview test are ineffective here.
Android: scrollbaralwaysdrawverticaltrack: sets whether the vertical scroll bar is always displayed. Scrollview and listview test are ineffective here.
Android: scrollbardefadeldelaybeforefade starts to fade after being set to N milliseconds, in milliseconds.
Android: scrollbarfadeduration: sets the time in milliseconds for the scroll bar to fade out. In android2.2, the scroll bar disappears after being rolled, and then appears again. It is displayed in versions 1.5 and 1.6.
Android: scrollbarsize: Set the width of the scroll bar.
Android: scrollbarstyle sets the style and position of the scroll bar. Set values: insideoverlay, insideinset, outsideoverlay, and outsideinset. There are not too many results. The following is a comparison between outsideoverlay and outsideinset:
Android: scrollemediumbhorizontal: sets the drawable (such as color) of the horizontal scroll bar ).
Android: scrollpolicumbvertical: Set the drawable (such as color) of the vertical scroll bar ).
Android: scrollbartrackhorizontal: Set the horizontal scroll bar background (track) color drawable (such as color)
Android: scrollbartrackvertical: Set the drawable of the vertical scroll bar background (track). Note that setting the color value directly, such as "Android: color/White", will produce a very ugly effect, and even won't even understand this attribute, see Res/drawable/scrollbar_vertical_thumb.xml and scrollbar_vertical_track.xml in apidemos. Set the code to Android: scrollbartrackvertical = "@ drawable/scrollbar_vertical_track"
Android: scrollbars. None (hidden), horizontal (horizontal), vertical (vertical ). See the following code to demonstrate how to use this attribute to enable a scroll bar in edittext. However, other containers, such as linearlayout, are set but have no effect.
Android: soundeffectsenabled
Android: Tag sets a text tag. You can use view. gettag () or for with view. findviewwithtag () to retrieve the view containing the tag string. However, it is generally better to query the view by ID because it is faster and supports type check during compilation.
Android: visibility: sets whether to display the view. Set Value: visible (default value, display), invisible (not displayed, but still occupied space), and gone (not displayed, not occupied space)
Code:
Android: duplicateparentstate
<Linearlayout Android: clickable = "true" Android: Background = "# ff0fff" Android: layout_width = "100dp" Android: layout_height = "100dp">
<Button Android: duplicateparentstate = "true" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content"/>
</Linearlayout>
Android: scrollbars
<Edittext Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content" Android: minheight = "50dp"
Android: Background = "@ Android: drawable/editbox_background"
Android: scrollbars = "vertical"
Android: maxlines = "4">
</Edittext>