gpt4 book ai didi

How to implement a linear gradient background with a curved divider(如何使用曲线分隔线实现线性渐变背景)

转载 作者:bug小助手 更新时间:2023-10-24 20:32:55 25 4
gpt4 key购买 nike



I have a layout in an android application and would like to implement a linear gradient where the top of the layout is white and the bottom is black with a curved divider in between. I have tried with the code below but it does not seem to draw the gradient as expected. How do I correctly modify the gradient file to achieve the the desired look?

我有一个Android应用程序中的布局,并想实现一个线性渐变,布局的顶部是白色,底部是黑色,中间有一个弯曲的分隔线。我已经尝试了下面的代码,但它似乎没有绘制出预期的渐变。如何正确修改渐变文件以获得所需的外观?



<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- White background at the top half -->
<item
android:top="50%"
android:drawable="@android:color/white" />

<!-- Black background at the bottom half -->
<item
android:bottom="50%"
android:drawable="#000000" />

<!-- Curve divider -->
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:topLeftRadius="0dp" android:topRightRadius="0dp"
android:bottomLeftRadius="16dp" android:bottomRightRadius="16dp" />
</shape>
</item>
</layer-list>

更多回答
优秀答案推荐

  <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:top="120dip">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/red" />
</shape>
</item>
<item android:bottom="240dip">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/black" />
</shape>
</item>
</layer-list>

更多回答

Like a diagonal divider where the left of that diagonal is black and the right white

就像对角线分隔线,对角线的左边是黑色,右边是白色

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com