前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[android] 手机卫士设置向导页面

[android] 手机卫士设置向导页面

作者头像
唯一Chat
发布2019-09-10 14:36:32
2.5K0
发布2019-09-10 14:36:32
举报
文章被收录于专栏:陶士涵的菜地陶士涵的菜地

设置向导页面,通过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

代码语言:javascript
复制
<?xml version="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
        style="@style/guide_text_list"
        android:drawableLeft="@android:drawable/btn_star_big_on"
        android:text="SIM卡变更报警" />

    <TextView
        style="@style/guide_text_list"
        android:drawableLeft="@android:drawable/btn_star_big_on"
        android:text="GPS追踪" />

    <TextView
        style="@style/guide_text_list"
        android:drawableLeft="@android:drawable/btn_star_big_on"
        android:text="远程数据销毁" />

    <TextView
        style="@style/guide_text_list"
        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

代码语言:javascript
复制
<?xml version="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>
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-04-10 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档