BloggerAds

2013年4月22日 星期一

Android - 如何使用Android內建的圖檔

Android內有許多已經簡單的圖檔



drawables

開發者不用再從網路上找

首先先交一下如何使用這些圖檔




以ImageButton當例子

<ImageButton

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:drawable/ic_media_pause" />



上面紅色的字就是使用Android內建圖檔的方法

android:background="@android:drawable/XXXXXX"

後面XXX的部分是名字

有人說用Eclipse內建的快捷鍵 Alt + / 只看的到字 想看圖怎麼辦

請打開你Android SDK的資料夾

圖檔的位置在裡面的

sdk\platforms\android-17\data\res\drawable-hdpi

路徑內的android-17是指API版本17的意思 選哪個應該都有

但是有些圖片在Android裡是Hide(隱藏的)

那就.....直接把喜歡的圖片複製到Drawable資料夾吧!