效果图:
1、布局界面代码:
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="stare"
android:text="获取网络图片" />
<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent" />
没有很多东东,就一个按钮一个ImageView控件
2、MainActivity.java
//图片地址
protected static final String PATH_BD = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=