gpt4 book ai didi

android - 如何像图像中那样在编辑文本后面发光?

转载 作者:行者123 更新时间:2023-11-29 02:19:34 25 4
gpt4 key购买 nike

enter image description here

我正在尝试获得类似 edittext 背景的发光效果

我试过了,但是背景不如图片有效

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#68F30606"/>
<corners android:radius="10dp" />
</shape>
</item>

<item
android:left="1.7dp"
android:right="1.7dp"
android:top="1.7dp"
android:bottom="1.7dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="10dp" />
</shape>
</item>
</layer-list>

谁能帮我解开这个谜团?

最佳答案

然后您将需要使用 9-Patch Drawing 的旧技术(有点)。我以前也这样做过。示例很少,因为它们很大,但有文档。

文档:https://developer.android.com/studio/write/draw9patch .

此外,如果这对您有帮助,您也可以检查一下:Outer glow in edittext

为此使用 Xml 中的 9-Patch 图像(记住这是在您创建 9-Patch 图像之后):

  1. 使用名称引用可绘制对象,但不包括 .9.png(eclipse 中的自动完成功能会处理此问题)

  2. 确保主/drawable 文件夹下只有 1 张图像(不是每个 dpi 文件夹的版本)

  3. 图像必须使用 :background 指定,而不是 :src (这让我卡住了一段时间)

    android:background="@drawable/splash_logo"

  4. 确保包含它的图像和布局正在使用:

    android:layout_width="fill_parent"<br/>
    android:layout_height="fill_parent"

致谢:Creating & Using 9-patch images in Android

此外,请查看此网站,其中包含许多文档未提供的有用示例: https://tekeye.uk/android/examples/ui/android-9-patch-image-files

关于android - 如何像图像中那样在编辑文本后面发光?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57229372/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com