The code is very simple to use
String alteredquote= '\u201D'+ "HELLO WORLD" + '\u201C';
you can find the html entites in the following link
http://www.javascripter.net/faq/mathsymbols.html
and to add color to the quotations
TextView title = (TextView) findViewById(R.id.textview);
Spannable wordtoSpan = new SpannableString(alteredquote);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.RED), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.RED),(alteredquote.length() - 1),(alteredquote.length()) , Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new RelativeSizeSpan(1.5f), 0, 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new RelativeSizeSpan(1.5f), (alteredquote.length() - 1), (alteredquote.length()),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
title.setText(wordtoSpan);
Enjoy!!!!1
No comments:
Post a Comment