Android Basics review--relativelayout layout properties, background, translucency settings (XML settings)

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/fansongy/article/details/6817968

Review the layout with XML and write an empty login interface. The XML comment I wrote at the back of the line. Program Run diagram:

The main function is not changed, not posted. The background image is named: Background.jpg. Let's see Main.xml.

[HTML]View Plaincopyprint?
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent"
  6. android:background="@drawable/background"//Set background
  7. >
  8. <linearlayout android:id="@+id/empty"//layout for placeholder
  9. android:layout_width="fill_parent"
  10. android:layout_height="wrap_content"
  11. android:layout_weight ="1"></linearlayout>//Set Percentage of total weight
  12. <relativelayout android:id="@+id/relativelayout"
  13. android:layout_width="fill_parent"
  14. android:layout_height="wrap_content"
  15. android:layout_weight="2"
  16. android:padding="10px">//Set inner spacing
  17. /* The color and opacity (alpha) values are indicated in hexadecimal notation. The range of values for any one color is 0 to 255 (00 to FF). For alpha,00, full transparency is expressed, and FF is completely opaque. The expression order is "Aabbggrr", where "aa=Alpha" (00 to FF); "bb=Blue" (00 to FF); "gg=Green" (00 to FF);rr= Red "(00 to FF). For example, if you want to apply a blue 50% opacity to an overlay, you should specify the following values: 7fff0000 */
  18. <TextView
  19. android:id="@+id/user"
  20. android:text="user name:"
  21. android:layout_width="fill_parent"
  22. android:layout_height="wrap_content"
  23. android:textcolor="#ffffffff" />
  24. <EditText android:id="@+id/username"
  25. android:layout_width="fill_parent"
  26. android:layout_height="wrap_content"
  27. android:layout_below="@id/user"//under the control with ID user
  28. android:background="#88ffffff"/>//Set opaque
  29. <TextView
  30. android:id="@+id/key"
  31. android:layout_width="fill_parent"
  32. android:layout_height="wrap_content"
  33. android:text="Password:"
  34. android:layout_below="@id/username"
  35. android:textcolor="#ffffffff" />
  36. <EditText android:id="@+id/keyword"
  37. android:layout_width="fill_parent"
  38. android:layout_height="wrap_content"
  39. android:layout_below="@id/key"
  40. android:background="#88ffffff"
  41. android:password="true"/>
  42. <checkbox android:id="@+id/remember"
  43. android:layout_height="wrap_content"
  44. android:layout_width="wrap_content"
  45. android:text="Remember password"
  46. android:layout_below="@id/keyword"
  47. android:layout_alignleft="@id/keyword"
  48. android:layout_marginleft="15px"/>//Outside spacing
  49. <checkbox android:id="@+id/autoin"
  50. android:layout_height="wrap_content"
  51. android:layout_width="wrap_content"
  52. android:text="Automatic login"
  53. android:layout_below="@id/keyword"
  54. android:layout_alignright="@id/keyword"//right-aligned with the control with ID keyword
  55. android:layout_marginright="15px"/>
  56. <button android:id="@+id/enter"
  57. android:layout_height="wrap_content"
  58. android:layout_width="fill_parent"
  59. android:gravity="center_horizontal"//Internal text position
  60. android:text="Login"
  61. android:layout_below="@id/autoin"
  62. android:layout_margin="10px"/>
  63. </relativelayout>
  64. </linearlayout>

This blog from the Asura Road, reproduced please indicate the source: http://blog.csdn.net/fansongy/article/details/6817968

Android Basics review--relativelayout layout properties, background, translucency settings (XML settings)

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.