【发布时间】:2014-05-27 00:16:00
【问题描述】:
假设我有一个像这样的 ImageView:
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/pic.png" />
我将在许多文件夹中为 pic.png 设置不同的大小:
- drawable-mdpi: 100*100px
- drawable-hdpi: 150*150px
- drawable-xhdpi: 200*200px
- drawable-xxhdpi: 300*300px
现在,如果我有这个 ImageView
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:src="@drawable/pic.png" />
drawable-* 中的图像应该是什么尺寸? 我的 ImageView 显然会匹配屏幕边界。
谢谢
【问题讨论】:
-
你应该在哪里使用什么尺寸?你已经告诉过你想要 match_parent
-
你必须更清楚你想要达到的目标。 我应该使用什么尺寸?