10、手机防盗--利用样式设计向导界面

样式以及向导界面一的布局文件可以参考上一节:http://blog.csdn.net/asmcvc/article/details/17587173

其他三个向导界面效果:

10、手机防盗--利用样式设计向导界面_第1张图片

10、手机防盗--利用样式设计向导界面_第2张图片

10、手机防盗--利用样式设计向导界面_第3张图片


大部分的界面设计同向导界面一,不同的地方是底部的按钮变为两个,一个是左对齐,一个是右对齐。

涉及到相对于父控件的靠齐摆放时,应使用RelativeLayout,然后设置控件属性为:

android:layout_alignParentRight="true"

或者设置样式属性为:

<item name="android:layout_alignParentRight">true</item>


向导界面二的布局文件:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView style="@style/title_text"
        android:text="2.手机卡的绑定" />

    <View style="@style/splitter_view"/>

    <TextView style="@style/content_text"
        android:text="一旦绑定sim卡\n下次重启手机如果sim卡变化,就发送报警短信到安全号码" />

    <RelativeLayout style="@style/relativelayout">
        <TextView style="@style/content_text"
            android:layout_gravity="left"
            android:text="点击绑定sim卡" />
        <ImageView
            android:id="@+id/iv_step2_bind_status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:src="@drawable/switch_off_normal"/>
    </RelativeLayout>

    <!--显示四个步骤的第二步:居中-->
    <LinearLayout style="@style/horizontal_linearlayout"
        android:layout_width="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="20dp">
        <ImageView style="@style/dot_disable_image" />
        <ImageView style="@style/dot_enable_image" />
        <ImageView style="@style/dot_disable_image" />
        <ImageView style="@style/dot_disable_image" />
    </LinearLayout>

    <!--显示一个大图标:居中-->
    <ImageView style="@style/center_icon_image"
        android:src="@drawable/bind"/>

    <RelativeLayout style="@style/relativelayout">
        <Button style="@style/prev_button" />
        <Button style="@style/next_button" />
    </RelativeLayout>

</LinearLayout>


向导界面三的布局文件:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView style="@style/title_text"
        android:text="3.设置安全号码" />

    <View style="@style/splitter_view"/>

    <TextView style="@style/content_text"
        android:text="sim卡更换后\n报警短信会发送到安全号码上" />
    <EditText
        android:id="@+id/et_step3_number"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:hint="请输入安全号码或者选择一个号码"/>
    <Button
        android:onClick="selectContact"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="选择联系人"/>

    <!--显示四个步骤的第三步:居中-->
    <LinearLayout style="@style/horizontal_linearlayout"
        android:layout_width="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="20dp">
        <ImageView style="@style/dot_disable_image" />
        <ImageView style="@style/dot_disable_image" />
        <ImageView style="@style/dot_enable_image" />
        <ImageView style="@style/dot_disable_image" />
    </LinearLayout>

    <!--显示一个大图标:居中-->
    <ImageView style="@style/center_icon_image"
        android:src="@drawable/phone"/>

    <RelativeLayout style="@style/relativelayout">
        <Button style="@style/prev_button" />
        <Button style="@style/next_button" />
    </RelativeLayout>

</LinearLayout>


向导界面四的布局文件:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView style="@style/title_text"
        android:text="4.恭喜你,设置完成" />

    <View style="@style/splitter_view"/>

    <TextView style="@style/content_text"
        android:text="强烈建议您开启防盗保护" />
    <TextView style="@style/content_text"
        android:text="点击激活deviceadmin\n(激活后可以远程锁屏,清除数据)" />
    <CheckBox
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:id="@+id/cb_step4_protect"
        android:text="防盗保护没有开启"/>

    <!--显示四个步骤的第三步:居中-->
    <LinearLayout style="@style/horizontal_linearlayout"
        android:layout_width="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="20dp">
        <ImageView style="@style/dot_disable_image" />
        <ImageView style="@style/dot_disable_image" />
        <ImageView style="@style/dot_disable_image" />
        <ImageView style="@style/dot_enable_image" />
    </LinearLayout>

    <!--显示一个大图标:居中-->
    <ImageView style="@style/center_icon_image"
        android:src="@drawable/setup4"/>

    <RelativeLayout style="@style/relativelayout">
        <Button style="@style/prev_button" />
        <Button style="@style/next_button"
            android:text="设置完成"/>
    </RelativeLayout>

</LinearLayout>

除了需要响应事件的控件设置id外,其他控件均没有设置id,另外“上一步”、“下一步”按钮虽然也响应事件,但是并没有设置Id是因为它们的响应事件写在样式里了。

这就意味着在Activity里一定要有prev和next这两个函数,下一节具体实现。




你可能感兴趣的:(10、手机防盗--利用样式设计向导界面)