gpt4 book ai didi

Android:EditTextPreference 将 String 转换为数字

转载 作者:行者123 更新时间:2023-11-29 22:29:13 25 4
gpt4 key购买 nike

我有一个带有 EditTextPreference 的简单 PreferenceActivity。我的问题是我将默认文本设置为电话号码(例如+14047771000)但是当点击首选项时,它显示为 double (在上面的示例中 - 1.404771E10)。我该怎么做才能防止这种情况并将文本显示为字符串?谢谢,乔尔

编辑:这是 xml:

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="IMS Preferences">
<PreferenceCategory android:title="Sip User">
<EditTextPreference android:key="PublicId"
android:title="Public ID" android:defaultValue="+14047771000"/>
</PreferenceCategory>
</PreferenceScreen>

编辑:任何人?有什么想法吗?

最佳答案

可以/需要在xml声明中设置文本类型。例如

<EditText android:inputType="phone" ....

关于Android:EditTextPreference 将 String 转换为数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4854121/

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