我一直在使用 4.1.......
TimePicker tpClock = (TimePicker) findViewById(R.id.tpClock);
View view = tpClock.getChildAt(0);
EditText etHours = (EditText) ((ViewGroup)((ViewGroup) view).getChildAt(0)).getChildAt(1);
这得到了 Hour 编辑文本,所以我可以隐藏它。
效果很好
但是它不适用于 4.2。我如何找到他们更改的内容?
谢谢
最佳答案
试试这个:
TimePicker view = new TimePicker(this);
View hour = view.findViewById(Resources.getSystem().getIdentifier("hour", "id", "android"));
View input = hour.findViewById(Resources.getSystem().getIdentifier("numberpicker_input", "id", "android"));
// then you can do this
input.setClickable(false);
input.setFocusable(false);
// or this
input.setVisibility(View.GONE);
关于android - 时间选择器 4.2 和获取编辑文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16425103/