gpt4 book ai didi

android - 我们如何在android中的textview中显示百分比符号

转载 作者:行者123 更新时间:2023-11-29 00:16:59 36 4
gpt4 key购买 nike

我正在使用 android TextView 来显示 manifest.XML 文件中的常量数据,我需要像这样显示文本 80% 但现在它显示 80。

这是我的 TextView 小部件,你能帮帮我吗。`

   <TextView
android:text="80" />

最佳答案

如果你想在 xml 文件中显示百分比,那么你必须像下面这样使用 strings.xml 文件:

<string name="percent_sign">80&#x0025;</string>

在您的布局文件中使用此字符串来显示百分比:

android:text="@string/percent_sign" />

or

android:text="80&#x0025;" />

代替

android:text="80" />

关于android - 我们如何在android中的textview中显示百分比符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25840873/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com