【发布时间】:2015-02-22 21:41:17
【问题描述】:
我有一个如下所示的活动 xml:
<LinearLayout 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:orientation="vertical"
android:baselineAligned="false">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:background="@drawable/top"
/>
<ScrollView
....
这基本上在线性布局顶部显示了一个横幅,下面是一个滚动视图。我遇到的问题是图像在某些设备上被拉伸。源图像宽度为 1080px(在 drawable 和 drawable-xxhdpi 文件夹中),drawable-xhdpi 中为 720px,drawable-hdpi 中为 540px,drawable-mdpi 中为 480。
我是否忘记了什么或给了错误的宽度?顺便说一句,图像被垂直拉伸。
感谢您的帮助!
【问题讨论】:
标签: android xml imageview android-drawable stretch