Android中的TextView 其实相当于很多语言中Label (比如Java Swing 的JLabel),主要是用于显示一个字符串。 比如:

<TextView android:id="@+id/lable1"

android:text="This is a Label"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:background="#cc0000"

android:textColor="#ffffff"

android:textSize="16sp"

android:padding="10dip"/>

android:background 设置TextView的背景颜色,

android:textColor 设置TextView的文字颜色。

android:textSize 设置TextView的字体大小。

效果如下:


android widget之TextView

如果要动态设置TextView的字符串,可以通过程序实现:

TextView tv = (TextView)findViewById(R.id.lable1);

tv.setText("setText ");

更多相关文章

  1. android常用颜色代码定义
  2. Android中获取颜色的几种方法
  3. CheckBox设置颜色和自定义样式
  4. Android 设置颜色的方法总结
  5. Android实现透明的颜色效果(zz)
  6. Android实现透明的颜色效果
  7. Android更改ProgressBar颜色
  8. 修改光标颜色

随机推荐

  1. Android(安卓)Studio项目报错:Caused by:
  2. Linux中遍历目录
  3. Android唤醒屏幕按键
  4. Android(安卓)横竖屏切换
  5. Android(安卓)Kotlin 接口函数
  6. Android(安卓)studio 配置SVN 报错问题解
  7. android 获取手机设备的唯一码(IMIE )
  8. 如何搭建android环境---windows系统环境
  9. Android(安卓)Intent用法汇总
  10. android 调用系统打电话和发短,懒得记