Android ui 元素不常用属性
android ui 元素不常用属性 |
||||
统计 |
||||
|
元素名称 |
统计 |
属性 |
描述 |
1 |
Button |
1 |
style=“?android:attr/borderlessButtonStyle”
|
去除 button 本身的阴影效果 该属性在API 11及以上可用 |
2 |
<?xml version=“1.0” encoding=“utf-8”?>
android:state_selected选中
android:state_focused获得焦点
android:state_pressed点击
android:state_enabled设置是否响应事件,指所有事件
|
Selector 按下效果 参考:https://blog.csdn.net/gtyvb/article/details/76864394 |
||
2
|
TextView
|
1 |
<TextView
|
android:includeFontPadding=“false” 文字默认会有上下留白(上下标) |
2 |
|
setext 设置多种颜色,使用网页方法html方法,设置文字属性 |
||
|
3 |
|
TextView 行间距(上下文本的间距) |
|
|
4 |
|
TextView 行间距(上下文本的间距)的倍数 |
|
|
5 |
|
TextView 删除线 |
|
|
6 |
|
设置内边距 |
|
3
|
RadioGroup RadioButton
|
1 |
<RadioButton
|
android:button=“@null” |
2 |
android:drawablePadding=6dp;//将文字和图片相距6dp |
|
||
4 |
LinearLayout |
1 |
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
动态设置 margin |
5 |
ImageView |
1 |
android:adjustViewBounds=”true” |
美工,或者后台给的图片大小不对,使用该属性可以自适应 – 参考网站 – |
6
|
EditText
|
1 |
|
去掉下划线 |
2 |
|
输入法弹出数字键盘,只能输入数字 |
||
|
3 |
EditText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());// 显示密码 EditText.setTransformationMethod(PasswordTransformationMethod.getInstance());// 隐藏密码 |
|
|
|
4 |
inputType 参数类型 |
|
|
7 |
ScrollView |
1 |
|
去掉滚动条 |
8 |
Recycleview
|
1 |
|
item 如果全是图片,每个 item 的上下间距回很大,给图片设置这个属性,就可以清除这些边距。 |
|
2 |
|
设置滑动到边缘时无效果模式: | |
|
3 |
|
设置不显示滚动条: | |
9 |
CheckBox |
|
android:button="@null"
|
不显示复选框 |