在文本视图上设置印度卢比符号

我正在开发一个应用程序。我需要设置文本视图上的印度卢比的符号,它与文本设置为金额。

符号:

enter image description here

我有这个资产/字体文件夹的字体或.TTF 文件。

我试着把它当做:

Typeface typeFace_Rupee = Typeface.createFromAsset(getAssets(),fonts/Rupee_Foradian.ttf");
TextView tvRupee = (TextView) findViewById(R.id.textview_rupee_mlsaa);
tvRupee.setTypeface(typeFace_Rupee);


// Tried to set symbol on text view as follows.
tvRupee.setText("`");

如上设置字体我得到了空指针错误。

在 Word 文件中,选择字体并输入 `后,我们得到了这个符号。但是在 android 中不起作用。

那么我应该按照什么步骤来做..。

101144 次浏览

Try this, Instead of Rupee_Foradian.ttf use Rupee.ttf it will work. am getting currency symbol.

Typeface tf = Typeface.createFromAsset(getAssets(), "font/Rupee.ttf");
textView1.setTypeface(tf);
textView1.setText("`");

enter image description here

Hi use this in Strings

For print rupee symbol: <string name="Rs">\u20B9</string>

For print Rs text: <string name="rs">\u20A8</string>

Use \u20B9 if you want to print the Rupee Symbol
and
Use \u20A8 if you want to print "Rs"

Copy-paste the Unicode to XML or Java and it works just fine. For more info on the Unicode refer http://www.fileformat.info/info/unicode/char/20b9/index.htm

Try this code snippet it's working fine in Xamarin.Forms

 CultureInfo india = new CultureInfo("hi-IN");


var rupeeSymbol = india.NumberFormat.CurrencySymbol;

use on Adapter

Viewholder.price.setText("Price: \u20B9"+dataAdapterOBJ.getPrice());
 public static String getIndianRupee(String value) {
Format format = NumberFormat.getCurrencyInstance(new Locale("en", "in"));
return format.format(new BigDecimal(value));
}

You can simply press Alt + Ctrl + 4

you can go with the below line of code for Flutter

child: Text('\u20B9 ${tx.amount}',
                        

Just simple write this code :

Text(
'\u{20B9}${2880.0}',
textAlign: TextAlign.start,
style: TextStyle(
color: const Color(0xFF000000),
fontSize: 15.0,
fontWeight: FontWeight.w300),
)

In 2022, to set number into Indian currency with currency symbol Example:

double rupee = list.getAmount();
String x = NumberFormat.getCurrencyInstance(new Locale("en","in")).format(rupee);

no need of any file etc, currency in Indian format that is comma after three digit from right with rupee symbol