I created this method to use from any where within my app
static String formatSellingPrice(Context ctx, String Original_Price, String Selling_Price, boolean isUnder_Promotion) {
String Currency_Symbol = ctx.getResources().getString(R.string.Currency_Symbol);
if (isUnder_Promotion) {
return String.format("<strike><font color=\"#757575\">%s %s</font></strike> %s %s", Original_Price, Currency_Symbol, Selling_Price, Currency_Symbol);
} else {
return Selling_Price + " " + Currency_Symbol;
}
}
it can be used if you have multi language and multi currency app
I call it like this:
String formated_SellingPrice = formatSellingPrice(this, Original_Price, Selling_Price, isUnder_Promotion);
then assign like this
tv_Card_Selling_Price.setText(Html.fromHtml(formated_SellingPrice));
xml-only
solution like me: https://mcmap.net/q/145988/-can-i-define-middle-lined-text-in-an-android-layout-xml-file – Riddle