标签: 杂谈 | 分类: Android开发(界面为主) |
Java代码:
复制代码
下面是代码代表的意思,大家要注意看了
Java代码:
-
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#ffc5d1d4"
- >
- <com.google.android.maps.MapView
- android:id="@+id/mapmain"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:clickable="true"
- android:apiKey="0P18K0TAE0dO2GifdtbuScgE
GLWe3p4CYUQngMg"
- />
- <TextView
- android:id="@+id/lblMicroJobsToday"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="MicroJobs for You Today Near:"
- android:textSize="20dp"
- android:textColor="#FF000000"
- android:layout_centerHorizontal="true"
- android:gravity="top"
- />
- <Spinner
- android:id="@+id/spnLocations"
- android:layout_width="250dp"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_marginTop="2dp"
- android:layout_below="@+id/lblMicroJobsToday"
- />
- <Button
- android:id="@+id/btnShowList"
- android:layout_width="150dp"
- android:layout_height="wrap_content"
- android:text="List Jobs"
- android:textSize="20sp"
- android:gravity="center_vertical"
- android:layout_centerInParent="true"
- android:layout_alignParentBottom="true"
- />
- </RelativeLayout>
Java代码:
-
- android:orientation
- //决定屏幕布局的“重心”方向。
-
- android:layout_width and android:layout_height
- //决定如何利用屏幕显示app的大小。
-
- android:background
- //决定app的背景颜色。(当有map覆盖后,这个属性其实作用不大)
-
- android:id
- //View的唯一的识别符,你将在java文件代码里使用这些id来和xml的view元素彼此交换。
-
- android:layout_width and android:layout_height
- //这2个属性和他们的parent元素息息相关,代码里使用了“fill_parent”指明了mapview将把它的父元
- //素大小填满。
-
- android:clickable
- //用户是否可以使用触屏点击。
-
-
- android:apiKey
-
-
-
- Section starting <TextView
- //此view就类似于一个Lable。告诉用户他在看什么。
-
- android:text
- //label的内容。
-
- android:textSize
- //字符的大小。
-
- android:textColor
- //字符的颜色。
-
- android:layout_centerHorizontal
- //字符的排列方向是否居中。
-
- android:gravity
-
-
-
- Section starting <Spinner
- //这是一个标准的android控件用来让用户选择最近的位置或者其他记录在用户配置文件里的位置。
-
-
- android:layout_below
- //这个属性控制了spinner的位置。表示了这个元素是位于某某id元素之后的。
-
- Section starting <Button>
- //一个按钮。用来触发显示工作信息列表。
-
-
- android:layout_width and android:layout_height
- //按钮大小。
-
- android:text
- //按钮上的名称。
-
- android:textSize
- //text的字符大小。
-
- android:layout_centerInParent
- //按钮位置是否居中。
-
- android:layout_alignParentBottom