android開發之路05,android之路05

來源:互聯網
上載者:User

android開發之路05,android之路05

一.擷取res資源檔下values中內容的方式:

1.string.xml檔案-------------------------------》 取值方式:getResource().getString(resourceID)或者getResource.getText(resourceID);

 

2.Arrays.xml檔案-----------------------------------》取值方式:getResource().getStringArray(resourceID);

 

3.Colors.xml檔案--------------------------------------》取值方式getResource().getDarwable(resourceID)或者getResource().getColor(resourceID);

 

4.Dimens.xml檔案---------------------------------------》getResource().getDimension(resourceID);

 

5.Style.xml-----------------------------------------------》不需要取值

 

二.AndroidManifest.xml資訊清單檔說明:

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

<!--package="com.rookie.hello"表示整個應用程式的主要包名,而且是一個預設的程式名稱

android:versionCode="1"表示該工程產生的apk的版本號碼,1開始不斷的遞增;

android:versionName="1.0"表示版本的名稱,1.0開始,其他版本名稱自由設定

android:installLocation="auto"apk會自動尋找安裝的目錄,ROM或者SDcard卡

internalOnly 僅僅只能安裝在ROM上

preferExternal 會直接安裝到sdcard卡上

 

  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.rookie.hello"

    android:versionCode="1"

    android:versionName="1.0" >

    <!--添加使用者的授權  -->

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <uses-sdk

        android:minSdkVersion="15"

        android:targetSdkVersion="23" />

<!--android:icon="@drawable/ic_launcher"表示我們應用程式logo圖片

android:label="@string/app_name"表示應用工程的文字說明

  -->

    <application

        android:allowBackup="true"

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name"

        android:theme="@style/AppTheme" >

        <!--android:name=".MainActivity"表示整個應用程式的主程式的名稱

        intent-filter:意圖過濾器,用來過濾使用者的動作和操作

        android.intent.action.MAIN:表示當前程式是整個工程的入口程式

        category android:name:表示決定應用程式是否在程式列表中顯示

           -->

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

聯繫我們

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