zoukankan      html  css  js  c++  java
  • [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

    <?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

    <?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>
  • 相关阅读:
    一台电脑上的git同时使用两个github账户
    git自己操作命令组集合
    git基本原理
    js如何遍历表单所有控件
    js如何访问表单(四种方法)(博客园+li的方式去掉p标签)
    js如何操作表格(常用属性方法汇总)
    php数学和时间常用函数有哪些(总结表)(看学习视频效率挺高的)(复习)
    swift 笔记 (十九) —— 协议
    ecshop广告调用方法
    K60 启动过程分析
  • 原文地址:https://www.cnblogs.com/taoshihan/p/5373836.html
Copyright © 2011-2022 走看看