【发布时间】:2017-09-29 19:33:34
【问题描述】:
我希望将我的Activity 的背景设置为两种颜色。顶部为自定义颜色,底部为白色。问题是我不想用水平线将它们分开。我想创建与提供的图像非常相似的东西。我真的不知道从哪里开始创建这个......
我试过了,但我真的不想水平分离。我希望分离更像图像。
这是我迄今为止尝试过的。
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#FAFAFA" />
</shape>
</item>
<item android:bottom="300dp" android:top="0dp" android:left="0dp" android:right="0dp">
<shape android:shape="rectangle">
<solid android:color="@color/colorPrimary" />
</shape>
</item>
</layer-list>
【问题讨论】:
-
我认为使用 Vector Drawables 可能会更好。developer.android.com/guide/topics/graphics/… 我过去所做的是创建一个 svg 图像并进行转换。
标签: android xml-drawable