zoukankan      html  css  js  c++  java
  • 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);

        }

    }

     

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    Operator开发实例
    Go构建HTTP服务
    Go依赖包的管理
    Go并发编程机制
    Go语言的基础数据类型
    k8s的APIServer流程介绍
    promise、resolve、reject、拦截响应
    AngularJS中service,factory,provider的区别
    scope
    sass入门
  • 原文地址:https://www.cnblogs.com/blogs-chao/p/4764910.html
Copyright © 2011-2022 走看看