布局代码:

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    ><TextView      android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:text="图片开始位置"    />    <ImageView     android:id="@+id/img1"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    />    <ImageView     android:id="@+id/img2"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    />    <ImageView     android:id="@+id/img3"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    />    <TextView      android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:text="图片结束位置"    /></LinearLayout>

activity代码:

public class SycLoadImg3 extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);loadImg("http://www.baidu.com/img/baidu_logo.gif",R.id.img1);loadImg("http://img3.cache.netease.com/www/logo/logo_png.png",R.id.img2);loadImg("http://www.iteye.com/images/logo.gif?1308833136",R.id.img3);}Handler handler = new Handler();ExecutorService threadPoll = Executors.newFixedThreadPool(5);private void loadImg(final String url,final int id) {threadPoll.submit(new Runnable() {@Overridepublic void run() {try {final Drawable drawable = ImgManager.getDrawableFromUrl(url);Thread.currentThread().sleep(2000);handler.post(new Runnable() {@Overridepublic void run() {ImageView img = (ImageView)SycLoadImg3.this.findViewById(id);img.setImageDrawable(drawable);}});} catch (Exception e) {e.printStackTrace();}}});}}

更多相关文章

  1. android process bar 几种style
  2. Android实现九宫格
  3. 获得Android(安卓)Linux系统增删文件的权限
  4. Android(安卓)图片侧滑展示RecyclerView简单实用
  5. android - 5大UI设计技巧
  6. Android版本与Linux内核版本的关系
  7. 开发Android第四步,Android(安卓)NDK 及 android gcc toolchain
  8. Android属性gravity与layout_gravity的区
  9. Android(安卓)制作.9.png图片之利用Android(安卓)9-patch shadow

随机推荐

  1. Android(安卓)自定义布局对话框避免全屏
  2. android 第一次运行应用的引导界面
  3. android使用util工具包
  4. Android(安卓)Socket网络通信
  5. Android设计模式系列(0)--开篇
  6. Android(安卓)AsyncTask
  7. android Canvas清屏只需三句话
  8. Android打开关闭触摸提示音
  9. android camera调试命令
  10. Android学习备忘022——FBReader源码解析