I am using a seekbar in a linearlayout in a ScroolView in a NavigationDrawer
NavigationDrawer > ScrollView > LinearLayout > SeekBar + other stuff
When I touch the seekbar I am unable to scroll up and down and I'd like to.
Here my function which allow me to slide the seekbar instead of slide the navigation drawer
private View onCritereView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View mView = inflater.inflate(R.layout.fragment_critere, container, false);
LinearLayout mLinearLayout = (LinearLayout) mView.findViewById(R.id.critere_linearlayout);
int i;
for (i = 0; i < mTitles.length; i++) {
View mViewElement = inflater.inflate(R.layout.item_critere, null);
((TextView) mViewElement.findViewById(R.id.critere_title)).setText(mTitles[i]);
SeekBar mSeekBar = (SeekBar) mViewElement.findViewById(R.id.critere_qualifier);
mSeekBar.setOnTouchListener(new ListView.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
int action = event.getAction();
switch (action)
{
case MotionEvent.ACTION_DOWN:
// Disallow Drawer to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
// Allow Drawer to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
// Handle seekbar touch events.
v.onTouchEvent(event);
return true;
}
});
mLinearLayout.addView(mViewElement);
}
return mView;
}
Now what I need is:
If you touch the seekbar and if you slide hozizontaly use seekbar.
else if you touch the seekbar and if you slide verticaly use scrollview
How can I do that ?
Thanks in advance :)