常用属性
以下是一些常用的Android TextView属性及其示例:
android:text: 设置TextView中显示的文本内容。
1 | <TextView |
android:textColor: 设置文本颜色。
1 | <TextView |
android:textSize: 设置文本大小。
1 | <TextView |
android:gravity: 设置文本的对齐方式。
1 | <TextView |
android:background: 设置TextView的背景颜色或背景图片。
1 | <TextView |
android:padding: 设置TextView的内边距。
1 | <TextView |
android:visibility: 控制TextView的可见性。
1 | <TextView |
android:fontFamily: 设置文本字体。
1 | <TextView |
android:maxLines: 设置最大显示行数。
1 | <TextView |
android:ellipsize: 设置文本过长时的省略方式。
1 | <TextView |