I have my own custom ScrollViewas the main Viewmine layout, which contains one single FrameLayoutand each other Viewis placed inside it. It looks like this (this is sm_layout.xml):
<com.effeleven.utils.CustomScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:background="@color/white"
android:clickable="true">
<FrameLayout...>
</com.effeleven.utils.CustomScrollView>
I did not have this exception when I used Android ScrollViewby default. Now I need a custom, because I need to handle events inside the scroll ScrollView(I have mapFragmentand ListViewI can not be replaced by anything, because I follow the template design). What can throw an exception since mine CustomScrollViewcontains only one FrameLayout, like the previous one ScrollView?
CustomScrollView:
public class CustomScrollView extends ScrollView {
public CustomScrollView(Context context) {
super(context);
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layoutInflater.inflate(R.layout.sm_layout, this, true);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
final int action = ev.getAction();
switch (action)
{
case MotionEvent.ACTION_DOWN:
super.onTouchEvent(ev);
break;
case MotionEvent.ACTION_MOVE:
return false;
case MotionEvent.ACTION_CANCEL:
super.onTouchEvent(ev);
break;
case MotionEvent.ACTION_UP:
return false;
}
return false;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
super.onTouchEvent(ev);
return true;
}
}