大世界——小人物

导航

Android项目——网络图片查看器


效果-=--------------》
加入包android-smart-image-view-1.0.0.jar




<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    tools:context="${relativePackage}.${activityClass}" >

 

    <!-- widthheigh设置0   weight表示 渲染的权重     当不指定值时代表的 优先级    默认是 值越大 优先级越低 -->

    <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:text="http://img0.bdstatic.com/img/image/shouye/dengni47.jpg"

        android:id="@+id/et"

        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:hint="浏览图片"/>

 

</LinearLayout>

-------------------------------------------------------------------------------------------------------------

public class MainActivity extends Activity {

   private EditText et_path;

 

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        et_path = (EditText) findViewById(R.id.et);

    }

   

    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 on 2014-08-06 18:43  大世界——小人物  阅读(221)  评论(0编辑  收藏  举报