问题:试图为一个简单的布局提供多设备支持屏幕,但在Nexus 6中它造成的问题,意味着不显示适合。它的另一面是减少nexus-6分辨率的文档为1440*2560的地方,图像应该是可绘制的-xxxhdpi .so i保持一个分辨率为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,它将扩展图像。请帮我摆脱这一切。这是屏幕截图-
layout.png
发布于 2015-12-02 13:49:17
将图像的宽度设置为fill_parent (如果您想要稍微小一点的imageView,也可以设置固定的宽度)
使用android:调整视图栏以保持高宽比
将高度设置为wrap_content (保持高宽比所需的一切)
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/icon"
android:id="@+id/imv"
android:scaleType="fitCenter" />发布于 2015-12-02 13:13:18
如果要在图像视图上匹配图像,请在xml代码中的imageview中将android:src替换为android: ImageView背景。
发布于 2015-12-02 13:14:02
尝试在布局中使用这些代码行
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:scaleType="fitXY"
android:id="@+id/imv" />https://stackoverflow.com/questions/34043611
复制相似问题