【发布时间】:2020-07-31 06:35:48
【问题描述】:
我正在尝试制作仅位于右下角的渐变背景。 (对不起图片,因为我没有足够的内联代表)
https://i.stack.imgur.com/ebgWn.jpg
首先,我做了径向渐变,但并不完美
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:centerX="0.9"
android:centerY="1"
android:endColor="#00000000"
android:gradientRadius="40%p"
android:startColor="#BF000000"
android:type="radial" />
</shape>
看起来像:
https://i.stack.imgur.com/JOqFf.jpg
然后,我做了线性渐变,但仍然不完美。
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="315"
android:endColor="#CD000000"
android:startColor="#00FFFFFF"
android:type="linear" />
</shape>
https://i.stack.imgur.com/a0y9C.jpg
因为 gradientRadius 参数不适用于线性渐变。此渐变是否有任何起点/终点参数?感谢您的帮助!
【问题讨论】:
-
为什么不将时间和刻度视图包裹在布局中,并仅在此布局中添加线性渐变背景..
标签: android android-layout android-xml