Android ImageView 显示本地图片
布局文件
1 <?xml version="1.0" encoding="utf-8"?> 2 <RelativeLayout 3 xmlns:android="http://schemas.android.com/apk/res/android" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent" 7 tools:context=".MainActivity"> 8 9 <ImageView 10 android:id="@+id/img" 11 android:layout_width="200dp" 12 android:layout_height="200dp" 13 android:layout_centerHorizontal="true" 14 android:layout_marginTop="50dp" 15 android:background="#aa111222" 16 android:onClick="getPicture" 17 /> 18 </RelativeLayout>
主文件