使用getChildAt方法层层查找来获取源码中按钮的索引值4
//onCreate方法中实现
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
try {
LinearLayout child = (LinearLayout) timePicker.getChildAt(0);
LinearLayout child1 = ((LinearLayout) child.getChildAt(4));
child1.setVisibility(View.GONE);
} catch (Exception e) {
e.printStackTrace();
}
}