让DatePick是不可编辑的

DatePicker m_dtPicker= (DatePicker) findViewById(R.id.dt_picker);
setDisabledTextViews(m_dtPicker);
private void setDisabledTextViews(ViewGroup dp)
{
for ( int x = 0 , n = dp.getChildCount(); x < n; x++)
{
View v = dp.getChildAt(x);
if (v instanceof TextView)
{
v.setEnabled( false );
}
else if (v instanceof ViewGroup)
{
setDisabledTextViews((ViewGroup)v);
}
}
}


转:http://www.bangchui.org/read.php?tid=24000

你可能感兴趣的:(Date)