/** Spinner extension that calls onItemSelected even when the selection is the same as its prevIoUs value */public class NDSpinner extends Spinner { public NDSpinner(Context context) { super(context); } public NDSpinner(Context context,AttributeSet attrs) { super(context,attrs); } public NDSpinner(Context context,AttributeSet attrs,int defStyle) { super(context,attrs,defStyle); } @OverrIDe public voID setSelection(int position,boolean animate) { boolean sameSelected = position == getSelectedItemposition(); super.setSelection(position,animate); if (sameSelected) { // Spinner does not call the OnItemSelectedListener if the same item is selected,so do it manually Now getonItemSelectedListener().onItemSelected(this,getSelectedVIEw(),position,getSelectedItemID()); } } @OverrIDe public voID setSelection(int position) { boolean sameSelected = position == getSelectedItemposition(); super.setSelection(position); if (sameSelected) { // Spinner does not call the OnItemSelectedListener if the same item is selected,getSelectedItemID()); } }}总结
以上是内存溢出为你收集整理的android – 如何在相同的微调器值选择上调用 *** 作全部内容,希望文章能够帮你解决android – 如何在相同的微调器值选择上调用 *** 作所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)