文档详情

android入门讲义.ppt

发布:2017-08-13约1.15万字共60页下载文档
文本预览下载声明
Android程序界面布局 RelativeLayout 按照各子元素之间的位置关系完成布局。在此布局中的子元素里与位置相关的属性将生效。 RelativeLayout里常用的位置属性如下:     android:layout_toLeftOf —— 该组件位于引用组件的左方     android:layout_toRightOf —— 该组件位于引用组件的右方     android:layout_above —— 该组件位于引用组件的上方     android:layout_below —— 该组件位于引用组件的下方    android:layout_alignParentLeft —— 该组件是否对齐父组件的左端    android:layout_alignParentRight —— 该组件是否齐其父组件的右端    android:layout_alignParentTop —— 该组件是否对齐父组件的顶部    android:layout_alignParentBottom —— 该组件是否对齐父组件的底部     android:layout_centerInParent —— 该组件是否相对于父组件居中     android:layout_centerHorizontal —— 该组件是否横向居中     android:layout_centerVertical —— 该组件是否垂直居中 TableLayout 此布局为表格布局,适用于N行N列的布局格式。一个TableLayout由许多TableRow组成,一个TableRow就代表TableLayout中的一行。 结束 练习题: 使用线性布局和相对布局,分布制作如图界面的程序。 要求: 分别使用2种布局,完成相同样式的程序 生成正式数字签名 发布为APK Android基本控件 1.文本类: TextView、EditText、AutoCompleteTextView、MultAutoCompletTextView 、(TextSwitcher) 、(DigitalClock) ExtractEditText、CheckedTextView、Chronometer 2.按钮类: Button、CheckBox、RadioButton(RadioGroup) 、ToggleButton 、(ImageButton ) CompoundButton 缩放按钮:ZoomButton、ZoomControls 3.图片类: ImageView、ZoomButton、ImageButton、(ImageSwitcher ) QuickContactBadge 4.时间控件: DigitalClock、AnalogClock、TimePicker、DatePicker 5.进度显示: ProgressBar、AbsSeekBar、SeekBar、RatingBar 6.导航: TabHost、TabWidget。 7.视频媒体: VideView、MediaController 8.Dialog对话框 CharacherPickerDialog、AlertDialog、DatePickerDialog、ProgressDialog、TimePickerDialog 常用控件 TextView xml: TextView android:id=@+id/test android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/hello_world / android:text 表示需要显示的文字 TextView属性对照表 常用控件 Button XML: Button android:id=@+id/button_first android:layout_height=wrap_content android:layout_width=wrap_content android:text=@string/buttonText / Button 获取该控件 Button button = (Button)findViewById(R.id.button_first); 监听动作 button.setOnClickListener(new View.OnClickListener() {   public void onClick(View v)
显示全部
相似文档