Android:EditTextPreference将String转换为数字

时间:2011-01-31 17:40:37

标签: android android-edittext preferenceactivity

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

编辑:这是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>

编辑: 任何人?任何想法?

1 个答案:

答案 0 :(得分:2)

您可以/需要在xml声明中设置文本类型。 E.g。

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

相关问题