格式金额字符串
回答
Android智能手机支持标或上标写任何文字。 您可以
Html.fromHtml("<sup>$</sup>1,500<sup>00</sup>");
尽量不使用HTML标签,您可以访问Subscript and Superscript a String in Android
它的工作原理,但我需要的解决方案,除了HTML标签。 –
@ V.J。看这里例如https://stackoverflow.com/a/8872986/3383038 –
@OlegOsipenko良好的信息。 –
//对于标和下标可以采取HTML标记的帮助下
String yourText="$1,050<sup>00</sup>";
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
yourTextView.setText(Html.fromHtml(yourText,Html.FROM_HTML_MODE_LEGACY))
} else {
yourTextView.setText(Html.fromHtml(yourText));
}
刚过去,它复制您的布局中:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
android:layout_height="match_parent">
<TextView
android:id="@+id/dollar"
android:text="$"
android:textSize="40dp"
android:gravity="top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_toRightOf="@+id/dollar"
android:id="@+id/ammount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80dp"
android:layout_marginTop="-10dp"
android:text="1,050"/>
<TextView
android:layout_toRightOf="@+id/ammount"
android:id="@+id/zeroes"
android:text="00"
android:textSize="40dp"
android:gravity="top"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
@ V.J。如果是你需要的,请接受 –
哦对不起。这是良好的尝试,但不适合我。因为我不得不改变我的布局。 –
- 1. 如何从格式化字符串中提取货币金额?
- 2. 从特定字符串获取金额
- 3. 价格字符串分成金额和货币
- 4. 使用HTML标记格式化字符串中的美元金额
- 5. 正则表达式从字符串中获取金额没有货币符号
- 6. 字符串格式
- 7. 字符串格式
- 8. 格式字符串
- 9. 格式字符串
- 10. 格式字符串
- 11. 从格式化金额提取货币
- 12. php echo货币格式加上金额
- 13. 打印号码时的金额格式
- 14. 表示具有典型金额格式
- 15. 实时格式化美元金额
- 16. 字符串格式符号
- 17. 使用字符串格式给出字符串值的格式
- 18. 字符串格式化在格式化整个字符串
- 19. 如何将字符串格式化为金钱
- 20. 格式化printf和额外的字符串打印?
- 21. 如何在javascript/jquery中添加字符串美元金额?
- 22. 从字符串中删除一笔金额 - Javascript
- 23. 有没有解决方案将字符串转换为金额?
- 24. 将字符串转换为SQL Server中的金额
- 25. 分裂货币及金额从字符串
- 26. 从字符串中移除货币金额
- 27. 从字符串中提取美元金额 - PHP中的正则表达式
- 28. 时间格式和字符串格式
- 29. Reg格式的字符串格式
- 30. C++贷款合格金额
这可能需要募集的美元符号和零专门的字体。 –