Thanks for your reply. I don“t know why the code not runs, I decided use the TimePickerDialog. However I put the full xml layout:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="1"> <TextView android:text="Date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold"/> <TimePicker android:id="@+id/timePicker" android:layout_height="wrap_content" android:layout_width="wrap_content" android:showSetButton="true"/> <TextView android:text="Time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold"/> </LinearLayout> <!-- If this element is erased, the dialog runs --> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id_medications/start_cancel" android:minWidth="80dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/cancel" /> <Button android:id="@+id_medications/start_ok" android:minWidth="80dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_weight="1" android:text="@string/done" /> </LinearLayout> </LinearLayout> On 1 abr, 21:00, "Megha Joshi" <[EMAIL PROTECTED]> wrote: > Hi, > > Your code seems to have the layout_width attribute, and your xml file seems > to be correct because you said removing the TimePicker makes everything else > work. > But again, your code here is incomplete so I am not sure if its an error in > your code or in the API. > You may want to paste a more complete version of your code here, or you > might just try using the TimePickerDialog, as shown in ApiDemos>view>Date > Widgets>Dialog. > > Thanks, > Megha > > On Tue, Apr 1, 2008 at 3:32 AM, ivan <[EMAIL PROTECTED]> wrote: > > > It is possible show a TimePicker view in a custom dialog? I have the > > below code and crash with the next error: "You must supply a > > layout_width attribute". The code which generate the error: > > XML > > [.....] > > <TimePicker android:id="@+id/timePicker" > > android:layout_height="wrap_content" > > android:layout_width="wrap_content" > > android:showSetButton="true"/> > > [....] > > > JAVA > > Dialog d = new Dialog(this); > > d.setContentView(R.layout.time); > > d.show(); > > > If I delete the TimePicker element from the layout, the activity runs > > correctly. > > Thanks > > > PD: TimerPickerDialog is not valid for me ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

