【发布时间】:2015-12-02 21:49:17
【问题描述】:
问题:试图为简单的布局提供多设备支持屏幕,但在 Nexus 6 中它会产生问题,意味着不适合。 根据文档,nexus-6 分辨率为 1440*2560 并且图像应该在 drawable-xxxhdpi 中。所以我保留了分辨率为 1440*2560 的图像。
<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">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:id="@+id/imv" />
</RelativeLayout>
如果我给 match_parent 如此明显它会拉伸图像。 请帮助我摆脱它。 这是屏幕截图-
【问题讨论】:
-
使用
android:scaleType="fitXY"来匹配ImageView中的图像 -
@ChiragSavsani 我知道,但如果与分辨率不匹配,它会拉伸图像
-
然后尽可能使用9patch drawable。
-
@ChiragSavsani 图像不是一种可以制作 9patch 的图像。还有其他方法可以使用吗?比如不同的文件夹或不同的图像大小?
-
你试过用 (fiil_parent) 代替 wrap_content 吗?
标签: android android-layout android-activity