【问题标题】:To create a stroke with shadow in android在 android 中创建带阴影的描边
【发布时间】:2015-06-24 07:29:10
【问题描述】:

我想创建一个带有描边和阴影的文本视图,如图所示,谁能帮我解决这个问题。

【问题讨论】:

    标签: android xml background strokeshadow


    【解决方案1】:

    试试这样的:

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item>
            <layer-list>
                <item android:right="5dp" android:top="5dp">
                    <shape>
                        <corners android:radius="3dp" />
                        <solid android:color="#8f0222" />
                    </shape>
                </item>
                <item android:bottom="2dp" android:left="2dp">
                    <shape>
                        <gradient android:angle="270" 
                            android:endColor="#E2E2E2"
                            android:startColor="#BABABA" />
                        <stroke android:width="1dp" android:color="#111111" />
                        <corners android:radius="4dp" />
                        <padding android:bottom="10dp" android:left="10dp" 
                            android:right="10dp" android:top="10dp" />
                    </shape>
                </item>
            </layer-list>
        </item>
    
    </selector>
    

    或此 SO 问题中的一些建议:Add shadow to custom shape on Android

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-26
      • 2021-10-06
      • 2016-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-28
      相关资源
      最近更新 更多