[英]how to use custom font style on string without any TextView on android
我正在使用沒有自定義字體更改選項的庫。 我如何在字符串中保存值並更改其字體,然后使用此字符串。 我做了很多搜索,但沒有TextView
找不到任何方法,因為我不需要任何TextView
。
TextView reg = findViewById(R.id.register);
FloatingActionMenu fab = findViewById(R.id.floatingActionMenu);
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(500);
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, "221");
sequence.addSequenceItem(
new MaterialShowcaseView.Builder(this)
.setTarget(reg)
.setContentText("I want to use custom font on this string")
.setDismissOnTouch(true)
.setShape(new RectangleShape(100,50))
.build()
);
sequence.addSequenceItem(
new MaterialShowcaseView.Builder(this)
.setTarget(fab)
.setDismissOnTouch(true)
.setContentText("I want to use custom font on this string")
.build()
);
sequence.start();
您可以通過在 string.xml 中使用CDATA
來更改字體顏色。
<string name="lable_testing">"You can change font color like this "<![CDATA[<font color="%1$s">hello</font>]]></string>
1-您是否嘗試下載庫並使用包含將該庫包含到應用程序中,然后更改該庫中的樣式
2-您是否嘗試添加所有您需要的自定義樣式,包括字體系列並將該樣式添加到 xml
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.