【发布时间】:2018-01-19 13:54:20
【问题描述】:
我使用渐变类型作为扫描,但startColor从3点开始,我该如何改变角度?
【问题讨论】:
-
只旋转你的drawable/view
-
@VladMatvienko 当我旋转视图时,视图周围会有空格
-
在问题中添加代码
我使用渐变类型作为扫描,但startColor从3点开始,我该如何改变角度?
【问题讨论】:
从代码中删除角度并给出 android:centerY="0.5" 和 android:centerX="0.5" 您的问题将得到解决。
<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle">
<gradient
android:type="sweep"
android:centerColor="#FA364D"
android:endColor="#212545"
android:startColor="#212545"
android:centerY="0.5"
android:centerX="0.5"/>
</shape>
【讨论】:
设置开始和结束颜色相同和不同的中心颜色并将centerX和centerY设置为0.5
试试这个
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:type="sweep"
android:centerY="0.5"
android:centerX="0.5"
android:centerColor="#303F9F"
android:endColor="#3F51B5"
android:startColor="#3F51B5" />
</shape>
【讨论】:
我找到了办法,
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
>
<gradient
android:type="sweep"
android:startColor="#212545"
android:centerColor="#FA364D"
android:endColor="#212545"/>
</shape>
我用上述背景创建了TextView 和android:rotation="135" 和android:scaleX="99" 和android:scaleY="99"。
【讨论】: