如下情况,难道是哪边漏操作了什么关键步骤了么?求解答~~~

在preference中需要用到一个EditTextPreference,然后需要对输入的内容进行限制,必须只能是整数,所以将EditTextPreference中的xml文件中的dialogLayout属性设置为自定义的edittext. 结果发现点击这个EditTextPreference并修改edittext中的值后都不好触发onPreferenceChanged这个函数,而且输入的值也不会自动被保存到sharedPreference里面,也无法通过getEditText().getText()这个函数获取输入的值~~~~

MMTTMM
浏览 154回答 1
1回答

catspeake

It is a subclass of DialogPreference and shows the EditText in a dialog. This EditText can be modified either programmatically via getEditText(), or through XML by setting any EditText attributes on the EditTextPreference.This preference will store a string into the SharedPreferences.意思应该是你可以在EditTextPreference里面使用任何的EditText的属性,那你还替换自定义的EditText做什么?
打开App,查看更多内容
随时随地看视频慕课网APP