android widget之TextView
16lz
2021-01-23
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的字体大小。
效果如下:
如果要动态设置TextView的字符串,可以通过程序实现:
TextView tv = (TextView)findViewById(R.id.lable1);
tv.setText("setText ");
更多相关文章
- android常用颜色代码定义
- Android中获取颜色的几种方法
- CheckBox设置颜色和自定义样式
- Android 设置颜色的方法总结
- Android实现透明的颜色效果(zz)
- Android实现透明的颜色效果
- Android更改ProgressBar颜色
- 修改光标颜色