1 / 22
文档名称:

Android智能手机软件开发教程.pptx

格式:pptx   大小:433KB   页数:22页
下载后只包含 1 个 PPTX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

Android智能手机软件开发教程.pptx

上传人:wz_198613 2019/12/4 文件大小:433 KB

下载得到文件列表

Android智能手机软件开发教程.pptx

相关文档

文档介绍

文档介绍:第4章界面布局与 常用资源使用掌握常见的布局方式,会通过XML文件构建线性布局、相对布局、绝对布局、表格布局、帧布局等常用布局。掌握在Activity中通过编程构建指定布局的方法,会向布局中增加常见的widget组件并显示。掌握在应用程序通过setContentView()方法引用XML布局资源的方法。本章学****目标用户界面UI一般由一组继承自View基类的某个可视化控件和ViewGroup构成。基类View提供了控件绘制和事件处理的基本方法,某个View对象的属性存储了屏幕上一个特定区域的布局参数和内容。,可在XML中采用如下方式为其分配ID号:android:id=“@+id/my_button”。ID可用于在Java代码中引用相应的控件。“@”表示XML解析器应该解析ID字符串并把它作为ID资源;“+”表示这是一个新的资源名字,。findViewById()取得布局上元素的句柄(前提是已经在布局Layout文件中设置好相应元素的ID)。、layout_width等,如:android:layout_width=“fill_parent”。在表示尺寸时可用确定的数字(如50px),也可以采用参数fill_parent或者wrap_content。:androidhttp://schemas./apk/res/androidandroid:orientation取值:vertical,horizontal。使用例: setOrientation()android:layout_widthfill_parent,wrap_content,或100dip,50dip等android:layout_height同上android:weight android:layout_weight0,1android:layout_gravity显示位置,默认为top,可取bottom、left、right、fill_vertical、fill_horizontal、center、fill、center_vertical、center_horizontal等。center_vertical为居中,余类似android:padding20sp,20dip等android:paddingTop20sp,20dip等android:id@+id/mynameandroid:autoText自动拼写帮助android:******@string/myname,或直接给定字符android:textColor#rgb,#argb,#rrggbb,#aarrggbb等android:textSize20sp,20dip等android:textAlign文字对齐,如取值center。(EditText没有这个属性)android:textScaleX控制字与字之间的间距,:textColorHighlight设置被选中文字的底色,,默认为蓝色android:typeface字型,取值可以为normal、sans、serif、monospace等android:editable指是否可编辑android:hint设置显示在控件上的提示信息android:textColorHint设置提示信息文字的颜色,如取值#ffff00,默认为灰色android:numeric设置输入数字类型,取值为integer表示只能输入整数,decimal表示输入小数android:capitalize取值为characters时,为显示大写字母android:textSize设置字体大小,如取值20dip等android:textStyle字体,取值为bold、italic、bolditalic等android:textColor设置字体颜色,如取值为#ff8c00等,(需引用相应的包)android:password取值true或false。为true时,输入显示为密码android:singleLine取值true或false,设置单行输入是否为真,如设置true,则不自动换行android:******@android:drawable/png,***@drawable/pngandroid:******@drawable/png或#rrggbbandroid