[android] 手機衛士設定嚮導頁面,android嚮導

來源:互聯網
上載者:User

[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

 

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

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.