作者superlubu (叔叔你人真好)
看板java
標題Re: [問題] Android中從URL載圖後切割放入Gallery
時間Sat May 22 06:30:21 2010
※ 引述《Geniusking (真理斯金)》之銘言:
: 這是"Google Android SDK開發範例大全"書中的範例EX08_05.java
: http://paste.plurk.com/show/258993/
: 會把myImageURL陣列中的5張圖下載後放到Gallery
: 我想例用我的PHP程式把他變成一張下載回來後再切成5張放到Gallery
: http://0rz.tw/admoU
: 我知道這五張圖可以分別用
: Bitmap.createBitmap(bm, 0, 0, 144, 144)
: Bitmap.createBitmap(bm, 144, 0, 144, 144)
: Bitmap.createBitmap(bm, 2*144, 0, 144, 144)
: Bitmap.createBitmap(bm, 3*144, 0, 144, 144)
: Bitmap.createBitmap(bm, 4*144, 0, 144, 144)
: 取得,但不知道要怎麼把5張圖秀在Gallery中,請大大們給個建議,謝謝!
那個範例已經很貼心了... 每個 method 的 comments 都有了
create 一個新的 myGalleryAdapter extends BaseAdapter
想辦法把那幅總圖塞進去
(不論是在 activity 先 load 還是讓 adapter 自己 load 也行)
然後小改一下 getCount, getItem, getItemId, getScale
在 getView 裡把 try {... } 那段由從網路下載圖檔改成根據 positionId 來
Split 總圖成相對的小圖,塞進 ImageView, return it.
finish....
--
很多人以為 所以我要 其實我是個
我是
大學生 告訴大家 三十一歲的
怪叔叔
● ●/ ︿ ︿
/
勁\ <
勁 ●
ㄨ /\ ㄨ
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.77.99.172
推 Geniusking:謝謝,我試試看:) 05/22 09:24
推 Geniusking:我的觀念上好像有點問題…那些getXXX不知道在那用到 05/22 16:23
推 NightGospel:若你有時間建議看完他的 Application Fundamentals 05/23 01:15
→ NightGospel:那本書我早期也只是拿來當作 Reference,現在沒在用了 05/23 01:17
推 Geniusking:我有看gasolin的那本入門,這部分只提到一點點 05/23 01:38
推 Geniusking:看了其他範例後大概知道要把5張圖變resource id 05/23 01:42
→ Geniusking:然後用ImageView.setImageResource去拿 05/23 01:44
→ Geniusking:但變Resource ID那邊又卡關了... 05/23 01:49
→ Geniusking:好像跟Resource id沒關系.. 05/23 03:02
→ Geniusking:原來我已經成功了...是createBitmap的參數xy帶錯...... 05/23 03:14
→ Geniusking:謝謝各位大大 05/23 03:16