在android中的卢比符号 [英] rupee symbol in android

查看:76
本文介绍了在android中的卢比符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码在android中显示卢比



字体face = Typeface.createFromAsset(getAssets(),Rupee_Foradian.ttf);

errormsgtodisplay.setTypeface(face);

errormsgtodisplay.setText(你的现金余额是+ getResources()。getString(R.string.rs)+ otherinformation);



它工作正常但它也改变了文字的字体样式你的现金余额我希望该文字应该使用以前的字体样式而不是 Rupee_Foradian的字体样式。 ttf

i display rupee in android using below code

Typeface face = Typeface.createFromAsset(getAssets(), "Rupee_Foradian.ttf");
errormsgtodisplay.setTypeface(face);
errormsgtodisplay.setText("Your Cash Balance is " + getResources().getString(R.string.rs)+otherinformation);

it works fine but it also changes font style of text Your Cash Balance is i want that text should use previous font style not that of Rupee_Foradian.ttf

推荐答案

为什么不使用Unicode字符?





使用< string>使用Unicode的资源。

http://developer.android.com/guide/topics/ resources / string-resource.html [ ^ ]



你可以使用

Why don't you use the Unicode characters?


use <string> resource with Unicode.
http://developer.android.com/guide/topics/resources/string-resource.html[^]

you can use either
<string name="rupee">\u20B9</string>






or

<string name="rupee">\u20A8</string> 


在代码中使用任何其他第二个参数

字体face = Typeface.createFromAsset(getAssets(),Rupee_Foradian.ttf);
use any other second argument in your code
Typeface face = Typeface.createFromAsset(getAssets(), "Rupee_Foradian.ttf");


如果上面的那些不起作用。试试这个



if above ones didn't work. try this

String string = "\u20B9";
byte[] utf8 = null;
utf8 = string.getBytes("UTF-8");
string = new String(utf8, "UTF-8");



稍后再谢谢


Thank me later


这篇关于在android中的卢比符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆