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>
  • 相关阅读:
    part11-1 Python图形界面编程(Python GUI库介绍、Tkinter 组件介绍、布局管理器、事件处理)
    part10-3 Python常见模块(正则表达式)
    Cyclic Nacklace HDU
    模拟题 Right turn SCU
    状态DP Doing Homework HDU
    Dp Milking Time POJ
    区间DP Treats for the Cows POJ
    DP Help Jimmy POJ
    Dales and Hills Gym
    Kids and Prizes Gym
  • 原文地址:https://www.cnblogs.com/taoshihan/p/5373836.html
Copyright © 2011-2022 走看看