如何为textview创建发光效果

问题描述 投票:0回答:1

我有一个用 kotlin 编写的应用程序,在我的应用程序中有添加所需用户文本行的功能。添加文本相对容易,但我被要求为文本添加效果。任何有想法的人请帮助我

这是我需要添加的效果

java android kotlin textview effect
1个回答
0
投票

我找到了解决问题的方法,我会在这里发布答案给需要的人

 tv.setShadowLayer(
                10f,     // radius: The radius of the shadow
                0f,      // dx: The horizontal offset of the shadow
                0f,      // dy: The vertical offset of the shadow
                Color.RED // shadowColor: The color of the shadow
            )

            // You can also customize other properties of the TextView
            tv.setTypeface(null, Typeface.BOLD)
© www.soinside.com 2019 - 2024. All rights reserved.