Fork me on GitHub

android绝对布局

 

绝对布局在游戏开发中常用,动态的计算出位置

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent" >
 5 
 6     <Button
 7         android:id="@+id/button1"
 8         android:layout_width="wrap_content"
 9         android:layout_height="wrap_content"
10         android:layout_x="20dp"
11         android:layout_y="12dp"
12         android:text="Button" />
13 
14     <Button
15         android:id="@+id/button2"
16         android:layout_width="wrap_content"
17         android:layout_height="wrap_content"
18         android:layout_x="202dp"
19         android:layout_y="51dp"
20         android:text="Button" />
21 
22     <Button
23         android:id="@+id/button3"
24         android:layout_width="wrap_content"
25         android:layout_height="wrap_content"
26         android:layout_x="57dp"
27         android:layout_y="169dp"
28         android:text="Button" />
29 
30     <TimePicker
31         android:id="@+id/timePicker1"
32         android:layout_width="wrap_content"
33         android:layout_height="wrap_content"
34         android:layout_x="46dp"
35         android:layout_y="253dp" />
36 
37 </AbsoluteLayout>

 

posted @ 2015-08-26 21:58  淡无心  阅读(1108)  评论(0编辑  收藏  举报