有没有办法在 Android 上向 TextView 添加内部阴影? [英] Is there a way to add inner shadow to a TextView on Android?

查看:34
本文介绍了有没有办法在 Android 上向 TextView 添加内部阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 textview 上制作 inner shadow,但我在网上找不到任何示例.

I would like to make an inner shadow on a textview, But I can't find any example of that on the web.

有没有办法在 Android 上做到这一点?

Is there any way to do that on Android?

我知道这些属性:

android:shadowColor
android:shadowRadius
android:shadowDx
android:shadowDy

我错过了什么有用的东西吗?

Am I missing something useful?

推荐答案

如果你想让 TextView 有这样的内阴影:

If you want the TextView to have inner shadow like this:

你必须像这样使用 9-patch drawable:

you have to use 9-patch drawable like this one:

将 9-patch drawable 设置为 TextView 的背景.

Set the 9-patch drawable as the TextView's background.

您提到的属性:android:shadowColor, android:shadowRadius, android:shadowDx, android:shadowDy 用于其他目的,它们创建文本阴影:

The attributes you mention: android:shadowColor, android:shadowRadius, android:shadowDx, android:shadowDy serve other purpose, they create text shadow:

这篇关于有没有办法在 Android 上向 TextView 添加内部阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆