Your code works fine, but when I click +/- for month for example, the textfield month becomes editable (but the others not), when I click +/- for day the textfield day becomes editable (but month and year not)....
There is a possibility to block this, no possibilité to edit any textfield in the DatePicker ? Thanks a lot :) On 10 mar, 19:06, Mike dg <vinb...@gmail.com> wrote: > So you don't want the textfields to be editable by typing, only by > pressing the arrows? > > Should be possible. The below code almost works. For some reason > whenever you click an arrow, it makes the corresponding text box > editable again. But if you hit an arrow on another textbox, then it > reverts back. > Please post the solution back so everyone can benefit if you use this. > > -Mike dg > DatePicker dp = (DatePicker)findViewById(R.id.DatePicker01); > setDisabledTextViews(dp); > > 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); > } > } > > On Mar 10, 5:39 am, djdamage06 <djdamag...@gmail.com> wrote: > > > Hello everybody, > > > Is it possible to disable the edition of fields in DatePicker ? Indeed > > when I touch on the editable box in the DatePicker, the keyboard > > appears... And I don't want this ! > > > Someone have an idea ? > > > Thanks a lot for your response :) > > > ---------------------------------------------------- > > > Bonjour à tous, > > > Existe-t-il un moyen de désactiver l'édition (et donc l'apparition du > > clavier) dans les champs d'un DatePicker ? En effet le fait que le > > clavier apparaisse lorsqu'on décide de n'appuyer ni sur + ni sur - > > mais directement dans le champ fait que ma layout est toute > > "bordélisée"... > > > Certes je pourrais anticiper ce mouvement par une Scrollbar mais c'est > > vraiment pas mon but... > > > Quelqu'un a une idée ? > > > Merci d'avance pour vos réponses smile -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en