android试卷A及答案

更新时间:2024-05-24 21:58:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Android应用试卷A

一、选择题(10分)

1. 下列不是手机操作系统的是?(D) A. Android B. Window Mobile C. Apple IPhone IOS D. windows vista

2. 下列选项哪个不是Activity启动的方法?( B ) A. startActivity B. goToActivity C. startActivityForResult D. startActivityFromChild

3. 下列哪个不是Activity的生命周期方法之一?( B ) A. onCreate B. startActivity C. onStart D. onResume

4. 下列哪个可做Android数据存储?( A ) A. SQlite B. MySql C. Oracle D. DB2

5. 下列哪个可做EditText编辑框的提示信息?( D ) A. android:inputType B. android:text C. android:digits D. android:hint

二、真空题(20分)

1. 为了使android适应不同分辨率机型,布局时字体单位应用 sp ,像素单位应用 sp 和 dip 。

2. 定义LinearLayout水平方向布局时至少设置的三个属性: android:orientation , android:layout_width 和 android:layout_height 。

3. 设置 ImageView控件为灰色的方法是: android:background=”#040” 。

4. layout布局文件的命名不能出现字母 大写 。 5. 设置EditText只能输入” 1234567890.+-*/%()”属性: android:digits 。

6. 设置TextView字体的属性是: android:textSize 。

三、简答题(30分)

1. Android项目中的入口Activity怎么写?如何注册一般的Activity? (1) Android项目中的入口Activity:

xmlns:android=\\

package=\

android:versionCode=\ android:versionName=\>

android:name=\ />

android:name=\ /> (2) 注册一般的Activity:

2. 列举通过Intent传递不同数据类型的方法(至少5个)? ①Intent.addCategory(String category) ②Intetn.addFlags(int flags) ③Intent.equals(Object o)

④Intent.fillIn(Intent other,int flags) ⑤Intent.filterEquals(Intent other)

3. 请介绍下Android中常用几种布局(至少3种,多一个加2分)?

线性布局LinearLayout,相对布局RelativeLayout,表单布局TableLayout,

帧布局FrameLayout,列表布局:listview,表格布局:gridview,绝对布局:absoluteLayout, 标签布局:tablayout

4. 阐述android:padding和android:layout_margin的异同?

(1)不同点:android:padding 是站在父View 的角度描述问题,它规定它里面的内容必须与这个父View 边界的距离。android:layout_margin 则是站在自己角度描述问题,规定自己和其他(上下左右)的 View 之间的距离如同一级只有一个View,那么他的效果基本上就和padding一样。(2)相同点:如同一级只有一个View,那么android:layout_margin的效果基本上就和android:padding一样

5. 列举TextView控件中的10个属性?

①android:text

②android:hint

③android:textColor ④android:textSize ⑤android:bufferType ⑥android:maxLines ⑦android:lines

⑧android:layout_width ⑨android:layout_height ⑩android:layout_gravity

四、编程题(40分)

1. 写出按钮和按钮单击事件(6分)

布局文件 :main.xml

xmlns:android=\\

android:layout_width=\ android:layout_height=\ >

android:layout_width=\ android:layout_height=\ android:text=\计算你的标准体重\ android:id=\ android:textSize=\

android:layout_centerHorizontal=\ android:layout_marginTop=\ />

android:layout_width=\ android:layout_height=\ android:text=\性别:\

android:layout_below=\ android:layout_marginTop=\ android:id=\ />

android:layout_width=\ android:layout_height=\ android:orientation=\ android:id=\

android:layout_below=\ android:checkedButton=\ >

android:layout_width=\ android:layout_height=\ android:id=\ android:text=\男\

/>

android:layout_width=\ android:layout_height=\ android:text=\女\

android:id=\ />

android:layout_width=\ android:layout_height=\ android:text=\身高:\

android:layout_below=\ android:layout_marginTop=\ android:id=\ />

android:layout_width=\

android:layout_height=\ android:layout_below=\ android:id=\ />

Top