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
二、真空题(2分)
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. 列举通过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=\ />
Activity:MainActivity.java
import android.app.MainActivity; import android.app.AlertDialog;
import android.content.DialogInterface; import android.os.Bundle; import android.view.View;
import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton;
public class MainActivity extends Activity {
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
Button btn = (Button)findViewById(R.id.btn);
btn.setOnClickListener(btnClickListener); }
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库android试卷A及答案在线全文阅读。
相关推荐: