你真的知道drawable和mipmap的區別嗎

你真的知道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>

代碼二對應效果如下
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章