I'm trying to build an activity on which the user can change a certain
date and time.
So I created an activity and a layout file, in the layout file
(containing more than just the date and time picker, you can see it
beneath) i define the date and time picker.
The application android 2.1 compatible, but I compile it under 3.2 so
that I can use the Holo theme in the entire application.

Running the application on 2.1 till 3.1 gives me the old-style date
and time picker, where you can type the value or press plus/minus.
Running on 3.2 or 4.0 gives me the new Holo styles date and time
picker, where you can also type or press plus and minus. So far so
good. But with the new style you can also scroll on the day, month,
year, hour and minute, but for some reason that doesn't quite work in
my application! What it does: I try to scroll down (let's say minute
is on 49, I want to change it to 30). It starts scrolling, and the
first pixels are just fine and smooth. But then it blocks and
everytime i initiate a scroll-swipe again it scrolls only a few
pixels. To scroll from 49 to 48 I have to scroll 5 or 6 times... Not
really normal I guess.

I also use the DatePickerDialog in some cases, there scrolling goes
smooth as supposed to be.

So is there anything I forget to do when using a date and/or time
picker in an activity?

Attachments:

Here is my layout file:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android";
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:orientation="vertical">
        <!-- Content... -->
        <DatePicker android:layout_width="fill_parent"
                    android:layout_height="wrap_content"/>
        <TimePicker android:layout_width="fill_parent"
                    android:layout_height="wrap_content"/>
        <!-- Content... -->
    </LinearLayout>
</ScrollView>

And here is the part of my activity where I set the values on the date
and time picker:
        datePicker = (DatePicker) findViewById(datePickerId);
        timePicker = (TimePicker) findViewById(timePickerId);

        datePicker.init(part.get(Calendar.YEAR),
part.get(Calendar.MONTH), part.get(Calendar.DAY_OF_MONTH), null);
        if (getAndroidApiVersion() >= 13) {
            datePicker.setCalendarViewShown(false);
            datePicker.setSpinnersShown(true);
        }

        timePicker.setIs24HourView(true);
        timePicker.setCurrentHour(part.get(Calendar.HOUR_OF_DAY));
        timePicker.setCurrentMinute(part.get(Calendar.MINUTE));

-- 
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

Reply via email to