![](/img/trans.png)
[英]JavaFX: Apply text color to TableCell using custom style sheet?
[英]custom text style with two color
我想知道可以這樣設置文本樣式:
注意:我正在使用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"/>
是的,您可以像這樣創建文本,請在此處查看我先前的詳細答案。
將文本顏色設置為white
並將輪廓顏色設置為black.
為什么不選擇具有自定義顏色的自定義字體? 此鏈接可以幫助您自定義字體。
嘗試這個
<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下載給Google,也可以使用更多的字體..
String fontPath = "fonts/mont.ttf";
Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
btn_reload.setTypeface(tf);
在TextView中使用陰影應該可以達到獲得輪廓效果的目的:
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之類的Web服務來查找任何圖片中使用的警察。 我用你的照片找到了最接近的匹配並得到了這個答案:
警察是Minutia Outline ,您可以在這里找到它 。
我不確定這是您所追求的解決方案,但是使用此警察將為您提供確切的照片。
如果您不想使用字體,則可以簡單地使用一些CSS設置文本樣式, 使用webView在Android中使用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%; }
<div class="strokeme"> Is this what you were looking for? </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.