學(xué)號-姓名-實驗9 Android應(yīng)用資源的使用_第1頁
學(xué)號-姓名-實驗9 Android應(yīng)用資源的使用_第2頁
學(xué)號-姓名-實驗9 Android應(yīng)用資源的使用_第3頁
學(xué)號-姓名-實驗9 Android應(yīng)用資源的使用_第4頁
學(xué)號-姓名-實驗9 Android應(yīng)用資源的使用_第5頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

實驗報告封面課程名稱:Android平臺開發(fā)與應(yīng)用課程代碼:SM3004任課老師:梁郁君實驗指導(dǎo)老師:梁郁君實驗報告名稱:實驗9Android應(yīng)用資源的使用學(xué)生姓名:學(xué)號:教學(xué)班:遞交日期:簽收人:我申明,本報告內(nèi)的實驗已按要求完成,報告完全是由我個人完成,并沒有抄襲行為。我已經(jīng)保留了這份實驗報告的副本。申明人(簽名):實驗報告評語與評分:評閱老師簽名:一、實驗名稱:事件處理二、實驗日期:2014/11/3三、實驗?zāi)康模?、掌握Drawable資源的使用。2、掌握菜單(Menu)資源的使用。3、樣式資源的格式的定義,主題資源的使用。4、掌握屬性資源和原始資源的使用。四、實驗用的儀器和材料:PC+Eclipse+ADT五、實驗的步驟和方法:1、綜合運用drawable、style、國際化等知識點,完成以下效果圖。圖1:設(shè)置系統(tǒng)語言為英語(美國) 圖2:設(shè)置系統(tǒng)語言為中文圖3:EditText獲得焦點根據(jù)上述的要求和UI,完成以下代碼片段:Values/strings.xml<?xmlversion="1.0"encoding="utf-8"?><resources><stringname="app_name">AndroidResourceDemo</string><stringname="action_settings">Settings</string><stringname="hello_world">Helloworld!</string><stringname="shapehint">shapetest</string><stringname="styletest">styletest</string><stringname="statelisttest">statelistdrawabletest</string></resources>values-zh-rCN/strings.xml:補(bǔ)充完整中文資源<?xmlversion="1.0"encoding="utf-8"?><resources></resources>Layout文件:activity_main.xml,補(bǔ)全代碼片段<LinearLayoutxmlns:android="/apk/res/android"xmlns:tools="/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity"><!--開始--><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world"/><!--測試layerdrawable資源--><ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"/><!--測試形狀(shape)資源--><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="@string/shapehint"/><!--測試statelistdrawable(selector)--><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="@string/statelisttest"/><!--使用style1--><EditTextstyle=""/><!--使用style2--><EditTextstyle=""/><!--使用style2,但自定義textColor為#00f--><EditTextstyle="@style/style2"/></LinearLayout>參考資源(請擺放到合適的目錄)Selector.xml<?xmlversion="1.0"encoding="utf-8"?><selectorxmlns:android="/apk/res/android"><itemandroid:state_focused="true"><!--定義當(dāng)獲取焦點狀態(tài)時的形態(tài)。--><shape><gradientandroid:startColor="#8600ff"android:endColor="#ffee00"/><strokeandroid:width="2dp"android:color="#000000"/><cornersandroid:radius="5dp"/><paddingandroid:bottom="10dp"android:left="10dp"android:right="10dp"android:top="10dp"/></shape></item><itemandroid:state_focused="false"><!--定義當(dāng)失去焦點時的形態(tài)--><shape><gradientandroid:startColor="#eac100"/><strokeandroid:width="2dp"android:color="#333333"/><cornersandroid:radius="8dp"/><paddingandroid:bottom="10dp"android:left="10dp"android:right="10dp"android:top="10dp"/></shape></item></selector>my_shape.xml<?xmlversion="1.0"encoding="utf-8"?><!--drawable-hdpi--><shapexmlns:android="/apk/res/android"><!--設(shè)置漸變顏色--><gradientandroid:startColor="#77ff77"android:endColor="#000000"/><!--設(shè)置內(nèi)邊距--><paddingandroid:left="10dp"/><!--設(shè)置圓角弧度--><cornersandroid:radius="10dp"></corners></shape>layer_logo.xml<?xmlversion="1.0"encoding="utf-8"?><layer-listxmlns:android="/apk/res/android"><itemandroid:left="10dp"android:top="10dp"><bitmapandroid:src="@drawable/ic_launcher"/></item><itemandroid:left="50dp"android:top="50dp"><bitmapandroid:src="@drawable/ic_launcher"/></item><itemandroid:left="90dp"android:top="90dp"><bitmapandroid:src="@drawable/ic_launcher"/></item></layer-list>Style.xml<?xmlversion="1.0"encoding="utf-8"?><resourcesxmlns:android="/apk/res/android"><stylename="style1"><itemname="android:textColor">#f00</item><itemname="android:text">@string/styletest</item><itemname="android:layout_width">match_parent</item><itemname="android:layout_height">wrap_conten

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論