I have a custom view with an onTouch() listener.
This view is added to a RelativeLayout so:
CustomView mv = new CustomView(mActivity);
RelativeLayout rl = ((RelativeLayout) mActivity.findViewById(R.id.main_layout));
rl.addView(mv);
I wish the view to be dragged with the finger under API8, preferably by code residing in the view’s own onTouch() listener.
It’s probably a few lines of code along the edge of setPadding() or RelativeLayout.LayoutParams(), but after one hour of trial and error, I can’t find it.
Any clues? Thanks a lot.
PS: The onTouch works like it should, I just don’t know what lines of code I could add to it that would move the view.
I would suggest to use FrameLayout and then change margin of your CustomView like this:
Hope this helps.