当前位置: 首页 > 工具软件 > Datepick > 使用案例 >

让DatePick是不可编辑的

弓举
2023-12-01
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

 类似资料: