I am trying to add view for signature in scroll view,So i have disabled scroll view when we start signature gesture on signature view and it's working fine. But i am trying to enable the scroll on parent layout onTouchlistner. But due to other views,scroll is not working properly .
I tried the following link,but unable to solve my issue.
This is to disable scollview on gesture touchlistner
digitalSignView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
//The following code is to disable scroll view on gesture touchListener.
ScView.setEnableScrolling(false);
return false;
}});
parentLayout.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
//The following code is to enable parent scroll view on outside touch event.
ScView.setEnableScrolling(true);
return false;
}
});
Please help me how to solve this issue.Thanks in advance.
Related
I am using dragging feature for recycler view by using ItemTouch helper.
Dragging is working fine but I am unable to use onclick listener on the same view.
Below is my code:
holder.mainLayout.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
mCommunicator.onStartDrag(holder);
return false;
}
});
holder.mainLayout.setOnClickListener(v -> {
//LogManager.v(LOG_TAG,"touch:"+blnOnTouch);
holder.checkBox.performClick();
});
Please suggest me for this issue. Thanks in advance.
There is a list view. I wrote this to stop the scroll when the user touches the screen while scrolling:
public class OnTouchListner implements OnTouchListener{
#Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction()==MotionEvent.ACTION_DOWN)
{
businessResultListView.smoothScrollBy(0, 0);
return true;
}
return false;
}
}
When i scroll the list down and when I touch the screen, the list view stops scrolling. But if I again try to scroll down / up, without lifting my finger from the scroll view, i am unable to scroll it.
If I take off my finger, then touch the list and then try to scroll, then I can do so.
How can I make my list scrollable after touch ?
Any help is greatly appreciated...
Give the Scroll id like scroll_home
ScrollView scroll_home;
scroll_home = (ScrollView) findViewById(R.id.scroll_event);
and on touch listview row add this function ...
this working well
v.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
scroll_home.requestDisallowInterceptTouchEvent(true);
return false;
}
});
I have an UI issue like, some EditText s are there in LinearLayout ,and this linear layout is placed in scroll view . now what i want to do is edit text has large amount of data for seeing this data i have set android:scrollbars ="vertical" by this i'm able to see the scroll bar inside the edit text but the data is not scrolling. out side scrollbar is moving.how to fix this issue.
can anybody help me. Thanks in Advance.
This may help you....
parentScrollView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
Log.v(TAG,"PARENT TOUCH");
findViewById(R.id.child_scroll).getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
childScrollView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event)
{
Log.v(TAG,"CHILD TOUCH");
// Disallow the touch request for parent scroll on touch of child view
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
In your case 'parentScrollView' is your scrollView while childScrollView is your Linearlayout/EditText
Use yourEditTextView.setMovementMethod(new ScrollingMovementMethod());
how can I disable the scrolling of a Scrollview, by the user? I want to scroll it by code
To answer this question:
I've done some research, and the following works the best:
scroll.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
return true;
}
});
As parsed from my working code.
I have an on touch listener for a webview, but it has a bad effect on the functionality of the webview, so I am wondering if there is anyway to removed the on touch listener after the initial interaction?
webView.setOnTouchListener(null);
So in you activity you would set your overridden onTouchListener:
mWebView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
v.setOnTouchListener(mWebView.mOnTouchListener);
return false;
}
});
And you would have to make a new class, extending WebView. And within it you would define an OnTouchListener.
public final OnTouchListener mOnTouchListener = new OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent rawEvent) {
return false;
}
};
Setting the ontouchlistener to null doesn't reset it to the default definition. You still have to provide an actual listener.
I was looking for help online and got to this post.
When I did
myView.setOnTouchListener(null);
my myView stopped responding to the onTouch.