Android UI controls
A½ ………… View 类
A1 ………… TextView 类
A2 ………… Button 类
A3 ………… EditText 类
A4 ………… RadioGroup 类
A5 ………… RadioButton 类
A6 ………… CheckBox 类
A7 ………… ProgressBar 类
A8 ………… ListView 类
ExpandableListView 类
A9 ………… Spinner 类
Aa ………… SeekBar 类
Ab ………… RatingBar 类
Ac ………… ImageView 类
Ad ………… Toast 类
Ae ………… WebView 类
Af ………… ToggleButton 类
Ag ………… AutoCompleteTextView 类
Ah ………… TimePicker 类
Android layout controls
D1 ………… FrameLayout 类
D1¼ ………… ScrollView 类
D1½ ………… HorizontalScrollView 类
D2 ………… LinearLayout 类
D3 ………… RelativeLayout 类
D4 ………… GridView 类
D6 ………… TableLayout 类
D7 ………… TableRow 类
---------------------------------------------------------------------------------------------------------
╔═════════╗
╠════╣ 第A½个 ╠══════════════════════════════════════════════════╣
╚═════════╝
1. 其它控件的基类,此类具有的方法属性,继承自它的类就都有。
2. View XML Attributes:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A1个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 文字显示, 类似标签.
2. TextView XML Attributes:
3. TextView Methods:
设置字体颜色:
textView.setText(Html.fromHtml("少就看到<font color=red>乐肤洁</font>积分了"));
跑马灯效果:
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
※ 参考:android TextView属性详解
☀☀☀<< 举例 >>☀☀☀
控件距离单位 - dip & 字体大小单位 - sp 举例:
效果:
实现代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:background="#000000" android:padding="5dip" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="5dip" android:textColor="#00FF00" android:text="距离展示:" /> <Button android:id="@+id/button1" android:layout_width="150dip" android:layout_height="50dip" android:text="150dip*50dip" /> <Button android:id="@+id/button2" android:layout_width="250dip" android:layout_height="35dip" android:text="250dip*35dip" /> <Button android:layout_width="match_parent" android:layout_height="50dip" android:textSize="15sp" android:text="textSize=15sp" /> <Button android:layout_width="match_parent" android:layout_height="50dip" android:textSize="20sp" android:text="textSize=20sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#00FF00" android:textSize="25sp" android:text="textSize=25sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#00FF00" android:textSize="30sp" android:text="textSize=30sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#00FF00" android:textSize="40sp" android:text="textSize=40sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#00FF00" android:textSize="50sp" android:text="textSize=50sp" /> </LinearLayout>
根据 pixels = dp * (dpi / 160) 对于相同的 dp 来说,dpi 越大,分辨率越高(屏幕显示越精细),相对应的 pixel 就越大,但是显示的宽度不会有太大的变化,从而达到在不同分比率中显示。
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A2个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 按钮.
若是想在其他的方法中调用某个按钮被电击的事件所产生的效果, 可以这样实现:首先要写好 button1 监听类的内容, 然后直接 new 一个监听类, 然后调用内部的 onClick() 方法, 将 button1 传递为参数即可实现. (performClick)
public class showButtonListener implements OnClickListener //监听类. {...} new showButtonListener().onClick(showButton); //实现 showButton 被点击.
2. Button XML Attributes:
3. Button Method:
public class Handler_Exer extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_handler__exer); Button buttonStart = (Button)findViewById(R.id.button01); //获取开始按钮 buttonStart.setOnClickListener(new StartButtonListener()); //设置开始按钮的点击事件 } class StartButtonListener implements OnClickListener{ //此类的 onClick 方法中写入要实现的功能, 实现 OnClickListener 接口 public void onClick(View v) { // TODO Auto-generated method stub system.out.println("Start"); //点击开始按钮实现的功能 } } }
---------------------------------------------------------------------------------------------------------
╔═════════╗
╠════╣ 第A2½个 ╠══════════════════════════════════════════════════╣
╚═════════╝
1. 图片按钮.
2. ImageButton XML Attributes:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A3个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 文本框.
2. EditText XML Attributes:
3. EditText Methods:
※ 参考:Android开发EditText属性
※ 参考:android中的ellipsize
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A4个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 一个 RadioButton 的组.
2. RadioGroup XML Attributes:
3. RadioGroup Methods:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A5个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 单选按钮.
2. RadioButton XML Attributes:
3. RadioButton Methods:
※ 参考:Android---RadioButton(单选按钮)详解
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A6个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 复选框.
<CheckBox android:id="@+id/star" style="?android:attr/starStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Star" />
通过点击五角星, 以颜色来区分是否选中!
2. CheckBox Methods:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A7个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. Visual indicator of progress in some operation.
2. ProgressBar XML Attributes:
3. ProgressBar Methods:
※ 参考:Android进度条(ProgressBar)应用实例
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A8个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. A view that shows items in a vertically scrolling list.
2. ListView Constructors:
3. ListView XML Attributes:
4. ListView Methods:
※ 参考:【068】 Android ListView & ExpandableListView
public class listAc extends ExpandableListActivity{ //继承与ExpandableListActivity @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); List<Map<String, String>> groups = new ArrayList<Map<String,String>>(); //一级目录数据 "group" Map<String, String> mapGroups = new HashMap<String, String>(); mapGroups.put("group", "Group One"); groups.add(mapGroups); mapGroups = new HashMap<String, String>(); mapGroups.put("group", "Group Two"); groups.add(mapGroups); List<Map<String, String>> child1 = new ArrayList<Map<String,String>>(); //一级目录第一个选项的内容部分 "child" Map<String, String> child1Data = new HashMap<String, String>(); child1Data.put("child", "Child1 One"); child1.add(child1Data); child1Data = new HashMap<String, String>(); child1Data.put("child", "Child1 Two"); child1.add(child1Data); List<Map<String, String>> child2 = new ArrayList<Map<String,String>>(); //一级目录第二个选项的内容部分 "child" Map<String, String> child2Data = new HashMap<String, String>(); child2Data.put("child", "child2 One"); child2.add(child2Data); child2Data = new HashMap<String, String>(); child2Data.put("child", "child2 Two"); child2.add(child2Data); List<List<Map<String, String>>> children = new ArrayList<List<Map<String, String>>>(); //二级目录数据 "child" children.add(child1); children.add(child2); SimpleExpandableListAdapter adapter = new SimpleExpandableListAdapter( listAc.this, //1. context groups, //2. 一级目录数据 R.layout.group, //3. 一级布局 new String[]{"group"}, //4. 一级key new int[]{R.id.groupItem}, //5. 一级控件 children, //6. 二级目录数据 R.layout.child, //7. 二级布局 new String[]{"child"}, //8. 二级key new int[]{R.id.childItem}); //9. 二级控件 setListAdapter(adapter); } }
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A9个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 下拉列表.
2. Spinner XML Attributes:
3. Spinner Methods:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_single_choice, presidents); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, presidents);
创建一个 Spinner 的步骤:
※ 参考:Android Spinner实例
※ 参考:Android Spinner的五个部分
☀☀☀<< 举例 >>☀☀☀
效果:
首先在 strings.xml 中加入字符串数组:
<string-array name="planets_array"> <item>Mercury</item> <item>Venus</item> <item>Earth</item> <item>Mars</item> <item>Jupiter</item> <item>Saturn</item> <item>Uranus</item> <item>Neptune</item> </string-array>
在 MainActivity.java 中写入如下代码:
public class MainActivity extends Activity {public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Spinner spinner = (Spinner) findViewById(R.id.spinnerId); //查找 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, //加入数据并建立显示样式 R.array.planets_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //下拉列表每一项的样式 spinner.setAdapter(adapter); //建立连接 } }
同样可以这样实现, 自己建立 list
public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List<String> list = new ArrayList<String>(); list.add("Monday"); list.add("Tuesday"); list.add("Wednesday"); list.add("Thursday"); list.add("Friday"); Spinner spinner = (Spinner)findViewById(R.id.spinner1); ArrayAdapter adapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list); //构造函数中加入 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //定义下拉样式, 默认与上面相同 spinner.setAdapter(adapter); }
效果(右面图示):
代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:padding="10dip" android:text="weekday ------ " /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/textView2" android:layout_alignBaseline="@id/textView2" android:textSize="20sp" android:text="Large Text" /> </RelativeLayout>
public class MainActivity extends Activity { public List<String> list; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list = new ArrayList<String>(); list.add("Monday"); list.add("Tuesday"); list.add("Wednesday"); list.add("Thursday"); list.add("Friday"); Spinner spinner = (Spinner)findViewById(R.id.spinner1); ArrayAdapter adapter = new ArrayAdapter(MainActivity.this, R.layout.item, R.id.textView2, list); //adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setPrompt("Choose a day:"); spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Toast.makeText(MainActivity.this, list.get(arg2).toString(), Toast.LENGTH_SHORT).show(); } public void onNothingSelected(AdapterView<?> arg0) { } }); } }
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Aa个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 可以手动拉动的进度条.
2. Seekbar Attributes:
public class MainActivity extends Activity { public SeekBar seekBar; public TextView textView; public TextView textView2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); seekBar = (SeekBar)findViewById(R.id.seekBar1); textView = (TextView)findViewById(R.id.textView1); textView2 = (TextView)findViewById(R.id.textView2); textView.setText("Progress = " + Integer.toString(seekBar.getProgress())); textView2.setText("Stop"); seekBar.setOnSeekBarChangeListener(seekBarChangeListener); } public OnSeekBarChangeListener seekBarChangeListener = new OnSeekBarChangeListener() { public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub textView2.setText("Stop"); } public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub textView2.setText("Start"); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub textView.setText("Progress = " + Integer.toString(progress)); } }; }
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Ab个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 评分 bar.
2. RatingBar XML Attributes:
1 public class MainActivity extends Activity { 2 public RatingBar ratingBar; 3 public TextView textView;public void onCreate(Bundle savedInstanceState) { 4 super.onCreate(savedInstanceState); 5 setContentView(R.layout.activity_main); 6 ratingBar = (RatingBar)findViewById(R.id.ratingBar1); 7 textView = (TextView)findViewById(R.id.textView1); 8 textView.setText("Progress = " + Integer.toString(ratingBar.getProgress())); 9 ratingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() { 10 public void onRatingChanged(RatingBar ratingBar, float rating, 11 boolean fromUser) { 12 // TODO Auto-generated method stub 13 textView.setText("Progress = " + Integer.toString(ratingBar.getProgress())); 14 } 15 }); 16 } 17 }
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Ac个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 图片显示控件.
2. ImageView XML Attributes:
3. ImageView Methods:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Ad个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. A toast is a view containing a quick little message for the user. The toast class helps you create and show those.
2. Toast Methods:
3. Toast Constants:
※ 参考:charSequence--刚认识的接口
举例:
Toast.makeText(getApplicationContext(), "成功", Toast.LENGTH_SHORT).show();
※ 参考:Android应用开发学习—Toast使用方法大全
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Ae个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. A View that displays web pages.
Note that, in order for your Activity to access the Internet and load web pages in a WebView, you must add the INTERNET
permissions to your Android Manifest file:
<uses-permissionandroid:name="android.permission.INTERNET"/>
2. WebView Methods:
public class MyBrowserActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.browser); Uri url = getIntent().getData(); WebView webView = (WebView) findViewById(R.id.WebView01); webView.setWebViewClient(new Callback()); webView.loadUrl(url.toString()); } private class Callback extends WebViewClient { @Override public boolean shouldOverrideUrlLoading (WebView view, String url) { return(false); } } }
※ 参考:Android webView 使用方法
1 public class WebViewActivity extends Activity { 2 /** Called when the activity is first created. */ 3 @Override 4 public void onCreate(Bundle savedInstanceState) { 5 super.onCreate(savedInstanceState); 6 setContentView(R.layout.main); 7 8 WebView wv = (WebView) findViewById(R.id.webview1); 9 10 WebSettings webSettings = wv.getSettings(); 11 webSettings.setBuiltInZoomControls(true); 12 /* 13 wv.loadUrl( 14 "http://chart.apis.google.com/chart" + 15 "?chs=300x225" + 16 "&cht=v" + 17 "&chco=FF6342,ADDE63,63C6DE" + 18 "&chd=t:100,80,60,30,30,30,10" + 19 "&chdl=A|B|C"); 20 */ 21 22 /* 23 wv.setWebViewClient(new Callback()); 24 wv.loadUrl("http://www.wrox.com"); 25 */ 26 27 /* 28 final String mimeType = "text/html"; 29 final String encoding = "UTF-8"; 30 String html = "<H1>A simple HTML page</H1><body>" + 31 "<p>The quick brown fox jumps over the lazy dog</p></body>"; 32 wv.loadDataWithBaseURL("", html, mimeType, encoding, ""); 33 */ 34 35 wv.loadUrl("file:///android_asset/Index.html"); 36 } 37 38 private class Callback extends WebViewClient { 39 @Override 40 public boolean shouldOverrideUrlLoading(WebView view, String url) { 41 return(false); 42 } 43 } 44 }
下载源代码:WebView.zip
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Af个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. Displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".
2. ToggleButton XML Attributes:
3. CheckBox Methods:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Ag个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 可以自动完成的 EditView. 但要提前加入字符串数组.
2. AutoCompleteTextView XML Attributes:
3. AutoCompleteTextView Methods:
String[] presidents = { ... }; //字符串数组 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, presidents); //数组加入到 ArrayAdapter 中, 默认显示模式. AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.txtCountries); textView.setAdapter(adapter); //将 adapter 与 AutoCompleteTextView 连接.
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Ah个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 时间的显示, 包括24小时的和AM/PM模式的.
2. TimePicker XML Attributes:
3. TimePicker Methods:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第Ai个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. 日期的显示.
2. DatePicker Methods:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第D1个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. FrameLayout is designed to block out an area on the screen to display a single item.
都是叠加在同一个区块,以最大的区块显示为框架。
效果:
实现代码:
<FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dip" > <Button android:layout_width="160dip" android:layout_height="160dip" android:background="#000000" /> <Button android:layout_width="100dip" android:layout_height="50dip" android:layout_gravity="bottom" android:layout_marginLeft="3dip" android:layout_marginBottom="3dip" android:background="#FF0000" /> <Button android:layout_width="100dip" android:layout_height="50dip" android:layout_gravity="right" android:layout_marginRight="3dip" android:layout_marginTop="3dip" android:background="#00FF00" /> <Button android:layout_width="50dip" android:layout_height="100dip" android:layout_gravity="left" android:layout_marginLeft="3dip" android:layout_marginTop="3dip" android:background="#00FFFF" /> <Button android:layout_width="50dip" android:layout_height="100dip" android:layout_gravity="bottom|right" android:layout_marginRight="3dip" android:layout_marginBottom="3dip" android:background="#FF00FF" /> <Button android:layout_width="46dip" android:layout_height="46dip" android:layout_marginLeft="57dip" android:layout_marginTop="57dip" android:background="#FFFF00" /> </FrameLayout>
---------------------------------------------------------------------------------------------------------
╔══════════╗
╠════╣ 第D1¼个 ╠══════════════════════════════════════════════════╣
╚══════════╝
1. 用来实现垂直滚动的效果,由于此类继承自 FrameLayout 类,因此内部要加入相应的布局控件才好用,否则都堆在一起了,例如在 ScrollView 内部加入一个 LinearLayout 或是 RelativeLayout等等。
java.lang.Object
↳ android.view.View
↳ android.view.ViewGroup
↳ android.widget.FrameLayout
↳ android.widget.ScrollView
---------------------------------------------------------------------------------------------------------
╔══════════╗
╠════╣ 第D1½个 ╠══════════════════════════════════════════════════╣
╚══════════╝
1. 同上面的 ScrollView 相对应,HorizontalScrollView 是专门设计为水平滚动效果的。而且它们之间也可以进行相应的嵌套。
效果:
第一幅图是最初效果,第二幅图则是上面两个 HorizontalScrollView 往右移动的效果,第三幅图则是整体 ScrollView 往下移动的效果。
实现代码:
<ScrollView> //实现最外面一层可以垂直滚动的. <LinearLayout> //垂直滚动内部加入 LinearLayout, 内部加入其它的三个 ScrollView.
<View/> //用于分割.
<HorizontalScrollView> //第一个水平 ScrollView. <LinearLayout> //内部水平 LinearLayout. <Button/> //水平的 N 个 Button. </LinearLayout> </HorizontalScrollView>
<View/> //用于分割.
<HorizontalScrollView> //第二个水平 ScrollView. <LinearLayout> //内部水平 LinearLayout. <Button/> </LinearLayout> </HorizontalScrollView>
<View/> //用于分割.
<ScrollView> //第三个垂直 ScrollView. <LinearLayout> //内部垂直 LinearLayout <Button/> </LinearLayout> </ScrollView>
</LinearLayout> </ScrollView>
<Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button02" /> <Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button03" /> <Button android:id="@+id/Button04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button04" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button05" /> <Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button06" /> <Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button07" /> <Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button08" />
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第D2个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. A Layout that arranges its children in a single column or a single row.
java.lang.Object
↳ android.view.View
↳ android.view.ViewGroup
↳ android.widget.LinearLayout
2. LinearLayout XML Attributes:
3. LinearLayout Methods:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第D3个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. A Layout where the positions of the children can be described in relation to each other or to the parent.
2. RelativeLayout 中控件可以使用的 XML Attributes: