android 基本控件

上传人:豆浆 文档编号:24744186 上传时间:2017-12-07 格式:PPT 页数:36 大小:2.07MB
返回 下载 相关 举报
android 基本控件_第1页
第1页 / 共36页
android 基本控件_第2页
第2页 / 共36页
android 基本控件_第3页
第3页 / 共36页
android 基本控件_第4页
第4页 / 共36页
android 基本控件_第5页
第5页 / 共36页
点击查看更多>>
资源描述

《android 基本控件》由会员分享,可在线阅读,更多相关《android 基本控件(36页珍藏版)》请在金锄头文库上搜索。

1、1,android 基本控件,疯狂android里面讲的超级详细,2,基本控件关系图,3,TextView、EditView、AutoCompleteTextView,Button、ImageButton、,RadioButton、CheckBox、ToggleButton,ProgressBar进度条,SekBar拖动条,RatinBar星级评分条,4,TextView、EditView、AutoCompleteTextView,Base Use,TextView显示文本内容,EditView输入文本内容,基本的设置文字大小,颜色,各个字体之间的宽度,限制输入长度或行数,类型、过长的文本省略

2、在何处等最基本操作,可编辑与不可编辑,mEditText.setFocusable(true);mEditText.setFocusable(false);显示与否android:visibility=visible、invisible、gonemlistview1.setVisibility(View.GONE);TextView官方文档解说http:/ http:/www.open- textview字体颜色显示和图片显示,5,TextView,设置超链android:autoLink=web|email显示文本会自动加横线为超链,例如显示文字 欢迎大家访问我的博客:http:/ (tv.

3、setMovementMethod(ScrollingMovementMethod.getInstance();)android:marqueeRepeatLimit=marquee_forever 在ellipsize指定marquee的情况下,设置重复滚动的次数,当设置为marquee_forever时表示无限次android:maxLines=15 ,6,EditText,welcome to use these PowerPoint templates, New Content design, 10 years experience,限制为输入, android:inputType=设

4、置只能输入数字,字母,密码,电话,日期,小数等等,也有提示文本输入。非限制情况下可用代码设置,html颜色,字体,下划线,甚至是插入图片。editText2.setText(Html.fromHtml( 红色代码 + 蓝色斜体代码+蓝色斜体加粗体下划线代码);void SetImage(int dra)Drawable drawable=getResources().getDrawable(dra);drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight();SpannableStri

5、ng spannableString = new SpannableString(pics);ImageSpan imageSpan=new ImageSpan(drawable,ImageSpan.ALIGN_BASELINE);spannableString.setSpan(imageSpan, 0, spannableString.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);editText3.setText(spannableString); ,7,EditText,welcome to use these PowerPoint templ

6、ates, New Content design, 10 years experience,限制为输入, android:inputType=设置只能输入数字,字母,密码,电话,日期,小数等等,也有提示文本输入。非限制情况下可用代码设置,html颜色,字体,下划线,甚至是插入图片。editText2.setText(Html.fromHtml( 红色代码 + 蓝色斜体代码+蓝色斜体加粗体下划线代码);void SetImage(int dra)Drawable drawable=getResources().getDrawable(dra);drawable.setBounds(0, 0, d

7、rawable.getIntrinsicWidth(), drawable.getIntrinsicHeight();SpannableString spannableString = new SpannableString(pics);ImageSpan imageSpan=new ImageSpan(drawable,ImageSpan.ALIGN_BASELINE);spannableString.setSpan(imageSpan, 0, spannableString.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);editText3.set

8、Text(spannableString); ,8,EditText, /文本类型,多为大写、小写和数字符号。 android:inputType=none/输入普通字符 android:inputType=text/输入普通字符 android:inputType=textCapCharacters/输入普通字符 android:inputType=textCapWords/单词首字母大小 android:inputType=textCapSentences/仅第一个字母大小 android:inputType=textAutoCorrect/前两个自动完成 android:inputTyp

9、e=textAutoComplete/前两个自动完成 android:inputType=textMultiLine/多行输入 android:inputType=textImeMultiLine/输入法多行(不一定支持) android:inputType=textNoSuggestions/不提示 android:inputType=textUri/URI格式 android:inputType=textEmailAddress/电子邮件地址格式 android:inputType=textEmailSubject/邮件主题格式,android:inputType=textShortMes

10、sage/短消息格式 android:inputType=textLongMessage/长消息格式 android:inputType=textPersonName/人名格式 android:inputType=textPostalAddress/邮政格式 android:inputType=textPassword/密码格式 android:inputType=textVisiblePassword/密码可见格式 android:inputType=textWebEditText/作为网页表单的文本格式 android:inputType=textFilter/文本筛选格式 android

11、:inputType=textPhonetic/拼音输入格式 /数值类型 android:inputType=number/数字格式 android:inputType=numberSigned/有符号数字格式 android:inputType=numberDecimal/可以带小数点的浮点格式 android:inputType=phone/拨号键盘 android:inputType=datetime/日期+时间格式 android:inputType=date/日期键盘 android:inputType=time/时间键盘,9,EditView,welcome to use thes

12、e PowerPoint templates, New Content design, 10 years experience,设置光标起始位置,颜色;横屏时软键盘的设定,大小写自动转换等等。http:/ to use these PowerPoint templates, New Content design, 10 years experience,不是Android的常用控件,但是它的实用性还是很强的 completionThreshold:它的值决定了你在AutoCompleteTextView至少输入几个字符,它才会具有自动提示的功能。另,默认最多提示20条。dropDownAnchor:它的值是一个View的ID,指定后,AutoCompleteTextView会在这个View下弹出自动提示。 dropDownSelector:应该是设置自动提示的背景色之类。dropDownWidth:设置自动提示列表的宽度。 ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);autocompletetextView.setAdapter(adapter); http:/

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号