效果-=--------------》加入包
<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}" >
<!-- 当width和heigh设置0时
weight表示 渲染的权重 当不指定值时代表的 优先级 默认是1 值越大 优先级越低 -->
<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);
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。