目录
1. TextView
2. EditText
3. ImageView
4. Button
4.1 去掉Button默认的点击阴影
控件添加属性
style="?android:attr/borderlessButtonStyle"
5. CheckBox
5.1 调整原生样式CheckBox的大小
【问题】即便设置layout_width和layout_height为wrap_content的时候发现他还是很大。
【方案】可使用【scaleX/Y】属性:
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content
android:scaleX="0.6"
android:scaleY="0.6"/>
【参考】https://blog.csdn.net/lintcgirl/article/details/48312309
5.2 调整原生样式CheckBox的颜色
【问题】原生样式的CheckBox带有点选动画,选中为绿色,未选中为灰色,且自带点击波纹效果。但如要修改点选颜色,却发现源码中使用的是图片而非色值。
【方案】自定义样式,并引用。
① 在[module>src>main>res>values>styles.xml]文件中,自定义样式。
其中“colorControlNormal”为未选中时的颜色,“colorControlActivated”为选中之后的颜色,色值可自定义:
<style name="InfoCheckBox" parent="Theme.AppCompat.Light">
<item name="colorControlNormal">@color/colorGray</item>
<item name="colorControlActivated">@color/colorRed</item>
</style>
② 在CheckBox控件中使用该自定义样式,注意,使用【android:theme】属性,而非“style”
<CheckBox
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:theme="@style/MyCheckBox" />
【参考】https://blog.csdn.net/ulddfhv/article/details/83047055
6. RecyclerView
7. Toolbar
8. CardView
8.1 CardView去除阴影
控件添加CardView属性:
app:cardElevation="0dp"