Bold or italic text in Toast without creating a View?

Summary

I want to create Toast without creating a View as content for Toast with bold inside Toast.

Question

Is it possible?

Update

How to create this effect?

+4
source share
2 answers

try something like this ...

Html.fromHtml() this makes the html style change our text

 Toast.makeText(MainActivity.this, Html.fromHtml("<big><b>exciting</b></big><small><i>and cool</i></small>text<br>"), Toast.LENGTH_SHORT).show(); 

Hope this helps ...

+15
source

Try it...

 Toast toast = new Toast(getApplicationContext()); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); toast.setDuration(Toast.LENGTH_LONG); toast.setView(layout); toast.show(); 
0
source

Source: https://habr.com/ru/post/1497996/


All Articles