[关闭]
@rg070836rg 2015-08-16T15:13:38.000000Z 字数 2729 阅读 1363

安卓布局

安卓


一、

安卓的布局,RelativeLayout配LinearLayout
android:background="@drawable/edit_shape"用xml文件来实现圆角

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:background="#377EB4" >
  6. <LinearLayout
  7. android:id="@+id/username"
  8. android:layout_width="200dp"
  9. android:layout_height="wrap_content"
  10. android:layout_centerHorizontal="true"
  11. android:layout_centerVertical="true"
  12. android:gravity="center"
  13. android:orientation="horizontal" >
  14. <EditText
  15. android:id="@+id/et_name"
  16. android:layout_width="0dp"
  17. android:layout_height="50dp"
  18. android:layout_weight="1"
  19. android:background="@drawable/edit_shape"
  20. android:ems="10"
  21. android:inputType="textPersonName" >
  22. <requestFocus />
  23. </EditText>
  24. </LinearLayout>
  25. <LinearLayout
  26. android:id="@+id/password"
  27. android:layout_width="200dp"
  28. android:layout_height="wrap_content"
  29. android:layout_alignLeft="@+id/username"
  30. android:layout_below="@+id/username"
  31. android:layout_marginTop="15dp"
  32. android:gravity="center"
  33. android:orientation="horizontal" >
  34. <EditText
  35. android:id="@+id/et_psw"
  36. android:layout_width="0dp"
  37. android:layout_height="50dp"
  38. android:layout_weight="1"
  39. android:background="@drawable/edit_shape"
  40. android:ems="10"
  41. android:inputType="textPassword" />
  42. </LinearLayout>
  43. <LinearLayout
  44. android:id="@+id/log_btn"
  45. android:layout_width="200dp"
  46. android:layout_height="wrap_content"
  47. android:layout_alignLeft="@+id/password"
  48. android:layout_below="@+id/password"
  49. android:layout_marginTop="15dp"
  50. android:gravity="center"
  51. android:orientation="horizontal" >
  52. <Button
  53. android:id="@+id/login_btn"
  54. android:layout_width="200dp"
  55. android:layout_height="wrap_content"
  56. android:background="@drawable/shape"
  57. android:text="登陆"
  58. android:textColor="#ffffff" />
  59. </LinearLayout>
  60. <RelativeLayout
  61. android:layout_width="200dp"
  62. android:layout_height="wrap_content"
  63. android:layout_alignLeft="@+id/log_btn"
  64. android:layout_below="@+id/log_btn"
  65. android:layout_marginTop="15dp"
  66. android:background="#377EB4" >
  67. <TextView
  68. android:id="@+id/for_psw"
  69. android:layout_width="wrap_content"
  70. android:layout_height="wrap_content"
  71. android:layout_alignParentRight="true"
  72. android:layout_alignParentTop="true"
  73. android:layout_marginRight="25dp"
  74. android:text="忘记密码?"
  75. android:textColor="#FFFFFF" />
  76. <TextView
  77. android:id="@+id/qui_reg"
  78. android:layout_width="wrap_content"
  79. android:layout_height="wrap_content"
  80. android:layout_alignParentTop="true"
  81. android:layout_marginRight="22dp"
  82. android:layout_toLeftOf="@+id/for_psw"
  83. android:typeface="monospace"
  84. android:text="快速注册"
  85. android:textColor="#FFFFFF" />
  86. </RelativeLayout>
  87. </RelativeLayout>

二、设置字体

  1. typeFace = Typeface.createFromAsset(getAssets(), "fonts/01.ttf");
  2. fp = (TextView) findViewById(R.id.for_psw);
  3. fp.setTypeface(typeFace);

三、注册页面

  1. <activity android:name="com.example.videotest.Res_View" >
  2. </activity>
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注