【问题标题】:How to achieve rounded corner with a diagonal inside it in a shape drawable?如何在可绘制的形状中实现带有对角线的圆角?
【发布时间】:2019-04-07 14:43:00
【问题描述】:

如何在android shape xml中实现如图所示的圆角和对角线形状?谢谢

【问题讨论】:

    标签: android android-drawable shapes


    【解决方案1】:

    您可以将rotate 元素与layer-list 一起使用。

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    
        <item>
            <shape android:shape="rectangle">
                <stroke
                        android:dashGap="5dp"
                        android:dashWidth="8dp"
                        android:width="8dp"
                        android:color="#989898"/>
                <corners android:radius="10dp"/>
            </shape>
        </item>
    
        <item>
            <rotate
                    android:fromDegrees="60"
                    android:toDegrees="45"
                    android:pivotX="50%"
                    android:pivotY="50%">
    
                <shape
                        android:shape="line">
                    <stroke
                            android:dashGap="5dp"
                            android:dashWidth="8dp"
                            android:width="8dp"
                            android:color="#989898"/>
                </shape>
            </rotate>
        </item>
    
    
    </layer-list>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-21
      • 2014-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多