android - 为什么影子没有出现?

标签 android xml shadow

文本出现了,@color/blue 在代码的其他地方都很好,还有什么阻止阴影出现?我已经为 shadowDxshadowDy 以及 shadowRadius 尝试了 1、10 和 100 的值。阴影既没有出现在编辑器中(这显然是预期的 TextView shadow not showing up in preview - although working on real device )也没有出现在我的手机上,这是我的测试设备。

    <TextView
        android:id="@+id/shadow_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="i should be shadowed ..."
        android:textColor="@android:color/white"
        android:shadowColor="@color/blue"
        android:shadowRadius="2"
        android:shadowDx="1"
        android:shadowDy="1"
        android:textSize="@dimen/text" />

最佳答案

它仅在我使用浮点值时才适用。试试这个:

 <TextView
        android:id="@+id/shadow_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="i should be shadowed ..."
        android:textColor="@android:color/white"
        android:shadowColor="@color/blue"
        android:shadowRadius="2.0"
        android:shadowDx="1.0"
        android:shadowDy="1.0"
        android:textSize="@dimen/text" />

是的,编辑器没有显示阴影,但它也应该显示一条注释,表明它不受支持。

关于android - 为什么影子没有出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10670630/

相关文章:

android - 在导航组件中包含来自 Backstack 的 fragment

xml - RDF Schema - 如何创建实例?

php - PHP的Javascript函数引发 “Illegally Formed XML Syntax”错误

cocoa - NSView 图层阴影绘制在 subview 上,而不是 View 本身

html - 是否可以在容器内提供阴影?

android - iOS 将 Cordova 应用程序作为 webview 嵌入到另一个应用程序中

android - 如何使用 android 中的相机捕获自定义图像大小?

java - 如何使用XPath通过另一个属性值获取属性内容?

flutter - 从 Flutter 中的 Scaffold AppBar 中删除阴影?

java - 如何在 AsyncTask 完成之前更新 ListView