Android Studio 2.0 预览版 3b
Hello,
我创建了以下布局,我想将其用作我的应用程序的背景。我正在使用layer-list
我想在两个位置展示一碗豌豆。预览中一切看起来都不错,但是当我在 genymotion 或一些廉价的中国设备上运行时,图像会在屏幕上延伸。然而,在 Android AVD 上,一切看起来都很好,在我的 Nexus 5(真实设备)上一切正常。
This is what I want and this is how it's displayed in the AVD and Nexus 5. As you can see there is no problem.
<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
And when I run on the genymotion and some cheap smart devices I get the following:
Just quick summary.
Nexus 5 real device and AVD devices works ok
Genymotion and cheap smart devices doesn't display correctly
我只是对我应该相信什么感到困惑。我也尝试过使用位图,看看这是否会产生任何影响。
非常感谢您的任何建议。
按如下方式更新您的图层列表
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:centerX="0.5"
android:centerY="0.1"
android:endColor="#08e25b"
android:gradientRadius="300dp"
android:startColor="#b7e9c9"
android:type="radial" />
</shape>
</item>
<item
android:width="48dp"
android:height="48dp"
android:bottom="68dp"
android:right="-20dp">
<bitmap
android:gravity="bottom|right"
android:src="@drawable/peas" />
</item>
<item
android:width="68dp"
android:height="68dp"
android:bottom="-20dp"
android:left="-20dp">
<bitmap
android:gravity="bottom|left"
android:src="@drawable/peas" />
</item>
</layer-list>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)