可能重复:
how to call the ok button in the EditTextPreference如何将SetOnClickListener()设置为EditTextPreference对话框的OK按钮?
我想验证输入(输入6位数字)的EditTextPreference对话框。
这是怎么我的(相关)的preferences.xml片段是这样的:
<!--EditTextPreference-->
<com.app.preferences.UpdatePincodePreference
android:key="PIN_CODE_PREFERENCE"
android:title="@string/pincode_preference_title"
android:summary="@string/pincode_preference_summary"
android:dialogTitle="@string/pincode_preference_dialog_title"
android:dialogMessage="@string/pincode_preference_dialog_message"
android:inputType="number"
/>
如何测试,在首选项对话框的EditText上的用户没有输入少于或多于6个数字?
基本上我需要在OK按钮上设置一个onClickListener(),但是如何获得我没有定义的OK按钮。它是EditTextPreference的默认视图,取消按钮也是如此。
问题与“how to call the ok button in the EditTextPreference”完全相同,但接受的解决方案中提供的链接现在已被破坏。
太棒了!那就是我正在看的东西。似乎是一个相当复杂的解决方案。将挖掘什么与我有关。日Thnx! – 2012-04-20 11:37:46
不知道在代码中发生了什么:(你能解释一下我的相关逻辑吗?我需要的是当用户在EditTextPreference对话框中按下确定按钮时,是否输入6位数字?Thnx! – 2012-04-20 11:56:09