I have the new datepicker implemented in an fragment. This is wrapped in a scrollview. When trying to use the datepicker i have to click and hold somewhere on the screen before i can scroll through the datepickers calader to let's say may.
is there a way to fix this?
im using this timepicker:
And im loading it like this:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView2"
android:layout_row="11"
android:fillViewport="true"
android:background="#162229"
android:layout_column="2"
android:paddingBottom="20dp">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:background="#162229"
android:orientation="vertical" >
<DatePicker
android:id="@+id/datePicker1"
android:layout_width="wrap_content"
android:background="#162229"
android:calendarTextColor="#fff"
android:layout_height="wrap_content"
android:calendarViewShown="false" > <!-- style="@style/date_picker_style" -->
</DatePicker>
</LinearLayout>
</ScrollView>
Create a class that extends DatePicker and override the following method:
@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN)
{
ViewParent p = getParent();
if (p != null)
p.requestDisallowInterceptTouchEvent(true);
}
return false;
}
It'll work fine. source : here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With