我在ImageView中的圖像都是像素化的,質量很低,幾乎模糊。他們都是我的可繪製文件夾中的48px x 48px
PNG文件。這是我的XML文件。ImageView圖像看起來像素化和低質量
<RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
android:id="@+id/main"
android:background="#ecf0f1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/my_photo1"
android:onClick="val1"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/ImageView"
android:layout_toStartOf="@+id/ImageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="0"
android:id="@+id/val"
android:textIsSelectable="false"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textSize="60dp"
android:textColor="#ff34495e" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ImageView"
android:src="@drawable/my_photo2"
android:visibility="invisible"
android:onClick="val2"
android:layout_alignTop="@+id/imageView"
android:layout_toLeftOf="@+id/imageView2"
android:layout_toStartOf="@+id/imageView2" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:src="@drawable/my_photo3"
android:visibility="invisible"
android:onClick="val3"
android:layout_alignTop="@+id/ImageView"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
android:src="@drawable/my_photo4"
android:visibility="invisible"
android:onClick="val4"
android:layout_alignTop="@+id/imageView2"
android:layout_toLeftOf="@+id/imageView4"
android:layout_toStartOf="@+id/imageView4" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:src="@drawable/my_photo5"
android:visibility="invisible"
android:onClick="val5"
android:layout_alignTop="@+id/imageView3"
android:layout_toLeftOf="@+id/imageView5"
android:layout_toStartOf="@+id/imageView5" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView5"
android:src="@drawable/my_photo6"
android:visibility="invisible"
android:onClick="val6"
android:layout_alignTop="@+id/imageView4"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Cup Cakes"
android:id="@+id/textView"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/imageView"
android:layout_toStartOf="@+id/imageView"
android:textColor="#ff34495e" />
</RelativeLayout>
有你在繪製-LDPI,繪製,MDPI,繪製,華電國際的文件夾設置不同的圖像尺寸如果沒有,那麼提供相同的圖像與SAMR的名字,但在這些各自的文件夾 –