自定义文字样式有两种颜色

问题描述 投票:4回答:4

我想知道可以像这样设置文本样式:

Text style example

注意:我使用的是shadow,但它对我来说似乎没用。我想得到一张如上图所示的双色文字。

这是我的代码:

<com.example.fabulous.comic.CustomTXT
    android:textColor="@color/white"
    android:shadowColor="@color/blacke"
    android:layout_margin="2dp"
    android:id="@+id/txt"
    android:text="hellow"
    android:layout_width="match_parent"/>
    android:layout_height="wrap_content"/>
java android android-studio colors background-color
4个回答
3
投票

是的,您可以创建这样的文本,请参阅我的previous详细解答。

将文本颜色设置为white并将颜色设置为toblack.


0
投票

为什么不选择自定义颜色的自定义字体?这个qazxsw poi可能会帮助您自定义字体。


0
投票

在TextView中使用阴影应该可以获得轮廓效果:

link

您还可以使用android:shadowColor="#000000" android:shadowDx="1.5" android:shadowDy="1.3" android:shadowRadius="1.6" android:text="CCC" android:textAllCaps="true" android:textColor="@android:color/white" 等网络服务查找任何图片中使用的警察。我用你的照片找到最接近的比赛并得到了这个答案:

WhatTheFont

警察是Minutia Outline,你可以WhatTheFont answer

我不确定这是你所追求的解决方案,但使用这个警察会让你得到你的照片。

如果你不想使用字体,你可以简单地使用一些CSS来设置你的文本样式,如下所示find it here

webView to use html/css
.strokeme
{
    color: white;
    text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
    font-size: 250%;
}

0
投票

试试这个

<div class="strokeme">
    Is this what you were looking for?
</div>

您可以根据需要增加半径并根据需要增加颜色

<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/hello_world" android:textColor="@color/white" android:textSize="20sp" android:shadowColor="@color/black" android:shadowRadius="2"/>

你也可以尝试使用字体.....

用于谷歌的Montserrat.ttp下载,你也使用了更多的字体..如你所愿

enter image description here
© www.soinside.com 2019 - 2024. All rights reserved.