0

I am using library which do not have custom font change's option. How I can save value in string and change its font and then use this string. I do a lot of search but can not find any way without TextView, because I do not need any 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(); 

2 Answers2

0

You can change font color by using CDATA in string.xml.

<string name="lable_testing">"You can change font color like this "<![CDATA[<font color="%1$s">hello</font>]]></string>
Bulma
  • 990
  • 3
  • 16
  • 35
  • I don't want to change color, As I mentioned on title I want to use custom fonts style. – Muhammad Usama Apr 22 '20 at 09:26
  • In order to custom fonts style. First of all, you have to download another fonts style. Then set font style programmatically – Bulma Apr 23 '20 at 09:26
  • There are many way that you can change font style. Check it out https://stackoverflow.com/questions/6612316/how-set-spannable-object-font-with-custom-font https://proandroiddev.com/font-typeface-in-android-application-572766edddd6 – Bulma Apr 23 '20 at 09:30
0

1- do you try to download library and include that library to app using include and then change the style in that library

2- do you try to add custom style with all you need include font family and add that style in xml

ahmed shaaban
  • 116
  • 1
  • 3