Search code examples
androiddialogstylesandroid-4.4-kitkattimepicker

TimePicker not displaying on android 4.4.2 - screenshots attached


I have 2 phones, a Nexus 4 with Android 5.0.1, and an LG f60 with Android 4.4.2 on it.

I have a custom dialog with this layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >

<DatePicker
    android:id="@+id/datePicker1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:calendarViewShown="false" > 
</DatePicker>

<TimePicker
    android:id="@+id/timePicker1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
</TimePicker>

</LinearLayout>

java:

LayoutInflater inflater = getLayoutInflater();
    View aboveLayout = inflater
            .inflate(R.layout.aboveLayout, null);
AlertDialog.Builder myDialog = new AlertDialog.Builder(this);
        myDialog.setView(aboveLayout);
...

and it displays correctly on Nexus 4, but something is wrong with the TimePicker on the LG f60. Here are the screenshot: enter image description hereenter image description here

What could be the problem? Thanks in advance!


Solution

  • Just try to use ScrollView. You can put your pickers under this view. It should fix the problem on small screens. By the way maybe it's better to have 2 dialog for date and for time. It's more conventional and user friendly.