我在strings.xml文件中使用以下字符串条目来显示卢比符号.
<string name="current_amount">"Balance: ₹%.2f"</string>
Run Code Online (Sandbox Code Playgroud)
它在Android 2.2上显示正方形而不是实际符号.
请帮忙.
PS:我在Android 2.2的模拟器上测试它,我没有2.2设备.
Joe*_*des 15
[编辑] Android 2.2的工作灵魂
好的,这是你如何让它工作.你必须Rupee_Foradian.ttf从这里下载字体并将其放在assets文件夹中.
然后,将此行放在strings.xml文件中
<string name="rs">`</string>
Run Code Online (Sandbox Code Playgroud)
最后使用以下代码设置Typeface:
TextView t = (TextView) findViewById(R.id.text);
Typeface face = Typeface.createFromAsset(getAssets(), "Rupee_Foradian.ttf");
t.setTypeface(face);
t.setText("Balance " + getResources().getString(R.string.rs));
Run Code Online (Sandbox Code Playgroud)
[原创]在Android 2.2上不起作用
将此行放在strings.xml文件中
<string name="rs">\u20B9</string>
Run Code Online (Sandbox Code Playgroud)
例如,在代码中,如果要将其分配给TextView,请执行以下操作:
TextView text = (TextView) findViewById(R.id.text);
text.setText("Balance " + getResources().getString(R.string.rs) + VALUE);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9275 次 |
| 最近记录: |