详解Android 手机卫士设置向导页面
详解Android 手机卫士设置向导页面
发布时间:2016-12-28 来源:查字典编辑
摘要:推荐阅读:浅析Android手机卫士自定义控件的属性浅析Android手机卫士关闭自动更新设置向导页面,通过SharedPreference...

推荐阅读:

浅析Android手机卫士自定义控件的属性

浅析Android手机卫士关闭自动更新

设置向导页面,通过SharedPreferences来判断是否已经设置过了,跳转到不同的页面

自定义样式

在res/values/styles.xml中

添加节点<style name=””>,设置名称属性

在<style>节点里面,添加节点<item name=””>设置名称属性,就是布局的各种参数

在<item>的文本里面,设置布局的各种参数值

在布局文件中引用样式,style=”@style/xxxxxxxxxxxx”

在TextView的左侧放置小图标

使用左侧图标属性android:drawableLeft=”@android:drawable/xxxxxxxxxxx”,引用android系统的图标,例如:@android:drawable/star_big_on

图标垂直居中对齐,使用对齐属性 android:gravity=”center_vertical”

引导页下面的小圆点

线性布局,横向,ImageView,包裹内容,整体居中

使用系统图标 @android:drawable/presence_online

@android:drawable/presence_invisible

自定义按钮状态背景

在res/drawable/button.xml文件中定义,添加节点<selector>

定义按钮按下状态 添加<item>节点,设置状态属性android:state_pressed=”true”

设置图片属性android:drawable=”xxxx”

设置按钮焦点状态 添加<item>节点,设置状态属性android:state_focus=”true”

定义按钮默认图片 添加<item>节点,设置图片属性android:drawable=”xxxx”

设置图片属性android:drawable=”xxxx”

布局文件中,给按钮设置背景,android:background=”@drawable/xxxxx”

activity_lost_find.xml

<"1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="40dp" android:background="#2D89EF" android:gravity="center" android:text="1.手机防盗设置向导" android:textColor="#fff" android:textSize="18sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="8dp" android:text="手机防盗包含以下功能:" android:textSize="16sp" /> <TextView android:drawableLeft="@android:drawable/btn_star_big_on" android:text="SIM卡变更报警" /> <TextView android:drawableLeft="@android:drawable/btn_star_big_on" android:text="GPS追踪" /> <TextView android:drawableLeft="@android:drawable/btn_star_big_on" android:text="远程数据销毁" /> <TextView android:drawableLeft="@android:drawable/btn_star_big_on" android:text="远程锁屏" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="horizontal" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/presence_online" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/presence_invisible" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/presence_invisible" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/presence_invisible" /> </LinearLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:textColor="#444" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginBottom="10dp" android:layout_marginRight="10dp" android:background="@drawable/button_selector" android:text="下一步" /> </RelativeLayout> </LinearLayout>

button_selector.xml

<"1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/barcode_btn_guide_pressed" android:state_focused="true"></item> <item android:drawable="@drawable/barcode_btn_guide_pressed" android:state_pressed="true"></item> <item android:drawable="@drawable/barcode_btn_guide_normal"></item> </selector>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新安卓软件开发学习
热门安卓软件开发学习
编程开发子分类