Android交互式视觉设计控件二
一.控件继承关系
二.常用控件
1.TextView
常用属性:
TextView:
android:text=“文本”
android:textSize=“20sp”
android:textColor="#FF0"
android:textStyle=“bold”
Typeface.BOLD //粗体
- Typeface.BOLD_ITALIC //粗斜体
- Typeface.ITALIC //斜体
- Typeface.NORMAL //常规
android:lines=“3”
android:singleLine=“true”
android:typeface=“monospace” //设置字体
常用的字体类型名称还有:
- Typeface.DEFAULT //常规字体类型
- Typeface.DEFAULT_BOLD //黑体字体类型
- Typeface.MONOSPACE //等宽字体类型
- Typeface.SANS_SERIF //sans serif字体类型
- Typeface.SERIF //serif字体类型
android:clickable=””
行间距
案例:
(1)跑马灯
1、TextView调出跑马灯效果
android:ellipsize=“marquee”
2、TextView获取焦点
android:focusable=“true”
android:focusableInTouchMode=“true”
(2)分割线
2.EditText
android:hint=“请输入QQ”
android:editable=“true”
android:maxLength=“50” 设置最大的字数
android:inputType=“textPassword”
3.Button
属性:同上
事件:onCLickListener
4.ImageView
属性:android:src="@drawable/ic_launcher"
android:scaleType="" 缩放模式
5.ImageButton
富文本:
https://blog.csdn.net/weixin_37744601/article/details/79603069
二.设置控件字的颜色
setTextColor(0xFF0000FF);
setTextColor(Color.rgb(255, 255, 255));
setTextColor(Color.parseColor("#FFFFFF"));
setTextColor(this.getResources().getColor(R.color.blue));
setTextColor(android.graphics.Color.BLUE);
更多相关文章
- 关于Android开发的editText控件怎…
- Android 基本控件 View 类的常用xml 属性(初级详解)
- android 控件-TextView用法整理
- Android Text控件之属性:android:textAppearance
- 项目中那些事|控件之TextView
- Android 修改程序字体
- [android]控件Button常用属性
- android字体的工作原理
- Android 控件view的可见,不可见,隐藏的设置和区别