tags:

views:

12

answers:

0

I create a dialog box with TimePicker inside it. This works very well on portraid mode, however, once it is changed into landscape mode, the timepicker minus button looks cropped.

here's my code: test.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"> 

<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time = " android:textSize="28dp"/>

<TimePicker android:id="@+id/PickTime" 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/text1" 
android:layout_alignLeft="@id/text1"/>

<Button android:id="@+id/StartStop" 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:layout_below="@id/text1" 
android:layout_toRightOf="@id/PickTime"/></RelativeLayout> 

My code for displaying the dialog box:

            LayoutInflater factory;
            factory = LayoutInflater.from(this);
            View textEntryView = factory.inflate(R.layout.test, null);

            AlertDialog dialog = new AlertDialog.Builder(this) 
                //.setTitle("Auto-Shutdown Setting")
                .setView(textEntryView)
                .setPositiveButton("Close", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {


                        dialog.cancel();
                        /* User clicked OK so do some stuff */
                    }
                })
                .create();
            dialog.show();


            TimePicker timePicker = (TimePicker) dialog.findViewById(R.id.PickTime);
            timePicker.setIs24HourView(true);
            timePicker.setCurrentHour(12);
            timePicker.setCurrentMinute(15);

            timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {

                public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {

                }


            });

Anyone knows why this is happening? Is it possible to customize the size of the dialog box (make it bigger)? Any other solution would be appreciated.

Thanks!