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);

        }

    }

     

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

  • 相关阅读:
    分治思想
    二分查找---查找区间
    二分查找---有序数组的 Single Element
    Ogre碰撞检测
    JavaScript常用检测脚本(正则表达式)
    Js+XML 操作
    C++难点的一些总结
    MFC使用简单总结(便于以后查阅)
    vc中调用Com组件的所有方法详解
    OSG+VS2010+win7环境搭建---OsgEarth编译
  • 原文地址:https://www.cnblogs.com/blogs-chao/p/4764910.html
Copyright © 2011-2022 走看看