基本组件API

标签:TextView

TextView的创建:代码中new TextView;在XML配置,还可使用if

相关属性:android:text android:textColor android:testStyle android:textface

ButtonTextView的子类

实现按钮监听方法:

1)在Activity上定义某个方法,接受按钮作为View参数,返回void,而且带public 修饰符。

2)在XML布局文件的Button中,添加android:onCLick特性,该特性的值为上步说的某个方法

图像部件:ImageViewImageButton ImageButtonImageView的子类

android:src指定要添加的图像

图像在Android中叫做可绘制资源

也可以使用setImageURI()方法基于ContentProvider实现

字段部件:EditText TextView的子类

属性:andorid:autotext andorid:capitalize andorid:digits andorid:singleLine(false:可键入多行)

复选框:CheckBox textView的子类

方法:isChecked() setChecked() toggle()

监听器:onCheckedChangeListener

单选按钮RadioButton

方法:isChecked() setChecked() toggle()

一般将RadioButton放于RadioGroup中,常用方法:

Check() clearCheck() getCheckedRadioButtonId()

视图View

常用属性:andorid:nextFocusDown andorid:nextFocusLeft

andorid:nextFocusRight andorid:nextFocusUp

andorid:visibility

方法:setEnabled():启用或停用组件 isEnabled()判断~

GetParent() fineViewById() getRootView()

颜色ColorStateList

改变TextView颜色方法:

1ColorStateList.valueof()

2)在XML中配置

更多相关文章

  1. android单选按钮RadioGroup的详细使用
  2. Android中一个Activity多个intent-filter的调用方法
  3. Android Studio点击按钮更换背景图片
  4. Android模拟SD卡实现方法解析
  5. Android编程实现屏幕自适应方向尺寸与分辨率的方法
  6. Android Studio导入Project的方法
  7. Android使用AudioRecord遇到的问题与解决方法
  8. 另类方法屏蔽Android4.03的HOME按键
  9. android SDK更新方法总结

随机推荐

  1. Android(安卓)的网络编程(15)-Http JSon
  2. 问题小结(6)-listview滚动条相关
  3. [转] android 日期时间格式转换
  4. Delphi XE5 android toast
  5. Ubuntu .bashrc个人配置
  6. 2010.10.31———Android(安卓)04
  7. Android(安卓)Socket编程初探
  8. Android多媒体开发(2)————使用Android(
  9. Android(安卓)WebView与网页JS相互调用
  10. Android联系人读取操作笔记