Android Studio 2.0 预览版 3b
你好,
我创建了以下布局,我想将其用作我的应用程序的背景。我正在使用layer-list
并且我想在 2 个位置展示一碗豌豆。预览中看起来一切正常,但是当我在 genymotion 或一些廉价的中国设备上运行时,图像会在屏幕上伸展。但是,在 Android AVD 上,一切看起来都很好,在我的 Nexus 5(真实设备)上一切正常。
这就是我想要的,这就是它在 AVD 和 Nexus 5 中的显示方式。如您所见,没有问题。
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:centerX="0.5"
android:centerY="0.3"
android:endColor="#08e25b"
android:gradientRadius="300dp"
android:startColor="#b7e9c9"
android:type="radial" />
</shape>
</item>
<item
android:width="48dp"
android:height="48dp"
android:left="350dp"
android:top="400dp">
<bitmap android:src="@drawable/peas" />
</item>
<item
android:width="68dp"
android:height="68dp"
android:drawable="@drawable/peas"
android:left="-20dp"
android:top="480dp" />
</layer-list>
我已将peas.png
文件放入drawable-nodpi
,只需在layer-list
当我在 genymotion 和一些便宜的智能设备上运行时,我得到以下信息:
Just quick summary. Nexus 5 real device and AVD devices works ok Genymotion and cheap smart devices doesn't display correctly
我只是对我应该相信什么感到困惑。我也尝试使用位图来查看是否会有所作为。
非常感谢您的任何建议。