你真的知道drawable和mipmap的区别吗?
代码一:图片放在mipmap下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_image">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/galery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/gallery_66" />
<ImageView
android:id="@+id/camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:src="@mipmap/camera_56" />
</LinearLayout>
<ImageView
android:id="@+id/editedImages"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@mipmap/mag" />
</LinearLayout>
</RelativeLayout>
代码一对应效果如下
代码二:图片放在drawable下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_image">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/select_ablum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/gallery_66" />
<ImageView
android:id="@+id/take_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:src="@drawable/camera_56" />
</LinearLayout>
<ImageView
android:id="@+id/edit_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/mag" />
</LinearLayout>
</RelativeLayout>
代码二对应效果如下