Summary of trivial knowledge points in Android programming (2)

Source: Internet
Author: User

1. interesting properties in the Control Configuration XML:
Android: Background
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: 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: 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 ).
Android: fadingedgelength
Set the length of the border gradient.
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: scrollpolicumbhorizontal
Set the drawable of the horizontal scroll bar.
Android: scrollpolicumbvertical
Set the drawable of the vertical scroll bar.
Android: scrollbartrackhorizontal
Set the color drawable 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: soundeffectsenabled
Set whether there is sound effect when you click or touch
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)

 

2. A classic layout. xml

XML Code
  1. <? XML version = "1.0" encoding = "UTF-8"?>
  2. <Linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android"
  3. Android: Orientation = "vertical" Android: layout_width = "fill_parent"
  4. Android: padding = "8px" Android: Background = "@ color/lightblue"
  5. Android: layout_height = "fill_parent" Android: gravity = "center_horizontal">
  6. <Linearlayout Android: Orientation = "vertical"
  7. Android: layout_width = "fill_parent" Android: layout_height = "wrap_content">
  8. <Textview Android: text = "@ string/qr_main_contents"
  9. Android: textcolor = "@ color/Black" Android: layout_width = "wrap_content"
  10. Android: layout_height = "wrap_content"/>
  11. <Spinner Android: Id = "@ + ID/qr_main_contents"
  12. Android: layout_width = "wrap_content" Android: layout_height = "wrap_content"
  13. Android: entries = "@ + array/qr_main_contents" Android: prompt = "@ string/qr_main_contents"/>
  14. </Linearlayout>
  15. <Linearlayout Android: layout_width = "fill_parent"
  16. Android: layout_weight = "1" Android: layout_height = "wrap_content"
  17. Android: scrollbars = "vertical">
  18. <Scrollview Android: layout_width = "fill_parent"
  19. Android: layout_height = "fill_parent">
  20. <Linearlayout Android: layout_width = "fill_parent"
  21. Android: layout_height = "wrap_content" Android: Orientation = "vertical">
  22. <Textview Android: text = "@ string/qr_information_name"
  23. Android: textcolor = "@ color/Black" Android: layout_width = "wrap_content"
  24. Android: layout_height = "wrap_content"/>
  25. <Edittext Android: Id = "@ + ID/qr_information_name"
  26. Android: textcolorhint = "@ color/Blue" Android: singleline = "true"
  27. Android: layout_width = "fill_parent" Android: layout_height = "wrap_content"/>
  28. <Textview Android: text = "@ string/qr_information_company"
  29. Android: textcolor = "@ color/Black" Android: layout_width = "wrap_content"
  30. Android: layout_height = "wrap_content"/>
  31. <Edittext Android: Id = "@ + ID/qr_information_company"
  32. Android: singleline = "true" Android: layout_width = "fill_parent"
  33. Android: layout_height = "wrap_content"/>
  34. <Textview Android: text = "@ string/qr_information_phone"
  35. Android: textcolor = "@ color/Black" Android: layout_width = "wrap_content"
  36. Android: layout_height = "wrap_content"/>
  37. <Edittext Android: Id = "@ + ID/qr_information_phone"
  38. Android: singleline = "true" Android: layout_width = "fill_parent"
  39. Android: layout_height = "wrap_content"/>
  40. <Textview Android: text = "@ string/qr_information_email"
  41. Android: textcolor = "@ color/Black" Android: layout_width = "wrap_content"
  42. Android: layout_height = "wrap_content"/>
  43. <Edittext Android: Id = "@ + ID/qr_information_email"
  44. Android: singleline = "true" Android: layout_width = "fill_parent"
  45. Android: layout_height = "wrap_content"/>
  46. </Linearlayout>
  47. </Scrollview>
  48. </Linearlayout>
  49. <Linearlayout Android: Orientation = "vertical"
  50. Android: gravity = "right" Android: layout_width = "fill_parent"
  51. Android: layout_height = "wrap_content">
  52. <Button Android: text = "@ string/qr_main_generate"
  53. Android: layout_width = "wrap_content" Android: layout_height = "wrap_content"/>
  54. </Linearlayout>
  55. </Linearlayout>

 

 

3. Remove the title bar and Information bar of the page.
This. requestwindowfeature (window. feature_no_title); // remove the title bar.
This. getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen); // remove the Information bar.

Note: This setting must be placed before the setting layout. Otherwise, an error will be reported.
Setcontentview (R. layout. entrancebs );

Related Article

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.