在控件中设置背景为selector_setting:(记得加clickable标签----->设置是否可以点击)
第二步:创建selector_setting.xml文件:
第三步,找两张不同的图片(博主是用shape实现的):如下:
setting_press.xml
实现的效果:
setting_normal.xml
实现的效果:
源码如下:
selector_setting.xml:
<?xml version="1.0" encoding="utf-8"?>setting_press.xml:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android=“http://schemas.android.com/apk/res/android”
android:shape=“oval”>
<size android:width=“32dp”
android:height=“32dp”/>
setting_normal.xml:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android=“http://schemas.android.com/apk/res/android”
android:shape=“oval”>
<size android:width=“32dp”
android:height=“32dp”/>
最后
**要想成为高级安卓工程师,必须掌握许多基础的知识。**在工作中,这些原理可以极大的帮助我们理解技术,在面试中,更是可以帮助我们应对大厂面试官的刁难。
[外链图片转存中…(img-IW4F8QDF-1723743985651)]
[外链图片转存中…(img-DUxVuC0a-1723743985651)]
以帮助我们应对大厂面试官的刁难。
[外链图片转存中…(img-IW4F8QDF-1723743985651)]
[外链图片转存中…(img-DUxVuC0a-1723743985651)]