SmartImageView-网络图片查看器

在gitHub.com里下载SmarImage

xml文件:

<com.loopJ.android.image.SmartImageView

        android:layout_weight="1000"

        android:id="@+id/siv"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"/>

<EditText

    android:singleLine="true"

    android:id="@+id/et+path"

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:hint="请输入图片路径"/>

<Button

    android:onClick="click"

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:text="浏览"/>   

 

MainActivity文件:

public void click(View view){

    SmartImageView siv = (SmartImageView) findViewById(R.id.siv);

    //第二个参数表示下载失败的时候显示的图片,第三个参数表示图片还在加载的时候显示

    siv.setImageUrl(et_path.getText().toString().trim(),

        R.drawable.ic_launcher, R.drawable.ic_launcher);

}

posted @ 2015-10-25 17:08  飞牛冲天  阅读(510)  评论(0编辑  收藏  举报