安卓 引導頁實現(第一次登陸)

來源:互聯網
上載者:User

標籤:

 

廢話不多說,先上代碼  https://git.oschina.net/alexgaoyh/AndriodTest


具體實現,網上有太多的教程了,下面僅僅說一下中間遇到的一些問題:


1:

preferences = getSharedPreferences("launchCount",MODE_WORLD_READABLE);
的方法,是會在/data/data/{包路徑}  產生對應的檔案的,預設情況下,是看不到的,所以我這裡的解決方案是,cmd進入到adb.exe中,之後賦予 755 的讀許可權


之後,在eclipse中,使用DDMS 的視圖,切換之後,就會看到對應的檔案路徑,裡面是有一個  launchCount.xml 的檔案的,這個就是他所對應的檔案



2: 另外一個注意的點,是在  AndroidManifest.xml中, 因為MainActivity.java要根據使用者是否登陸過進行判斷,是否使用Intent啟動系統組建,這樣的話,他要在xml裡面增加配置項,如下:

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.alexgaoyh.andriodtest"    android:versionCode="1"    android:versionName="1.0" >    <uses-sdk        android:minSdkVersion="8"        android:targetSdkVersion="21" />        <application        android:allowBackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:theme="@style/AppTheme" >                <activity android:name="com.alexgaoyh.andriodtest.launchGuide.LaunchGuideViewActivity"><intent-filter>  <action android:name="com.alexgaoyh.andriodtest.MainActivity" /><category android:name="android.intent.category.DEFAULT" /></intent-filter> </activity>                <activity            android:name=".MainActivity"            android:label="@string/app_name" >            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>    </application></manifest>
注意 intent-filter部分。




這樣,andriod的引導頁功能就簡單的實現了,不過存在一些問題:

1:最後一個引導頁缺少 ’立即體驗‘ 的按鈕;

2: 首頁功能未實行。。


後期會進行實現並更新git

安卓 引導頁實現(第一次登陸)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.