Android - NumberPicker - 取得內部 middle row 的EditText物件

Android - NumberPicker - 取得內部 middle row 的EditText物件

numberPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);

try {
    Class internalRID = Class.forName("com.android.internal.R$id");
    Field edit = internalRID.getField("numberpicker_input");
    EditText editText = (EditText)numberPicker.findViewById(edit.getInt(null));
    editText.setVisibility(View.GONE);
    editText.setClickable(false);
} catch (Exception ex) {
    ex.printStackTrace();
}