I want to make detail view. When clicking on an object, a detail layout appears from the bottom. It is possible to move the layout by touching any where on the layout.
I've used some code, it doesn't work correct. When I touch the layout, top side of the layout appears on the bottom of touching point. Plus there is some margin between touching point and top side of layout
Example pics shows what I mean. It is mapping app "2gis"
mLinearLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams();
if (view.getId() != R.id.bottomPanel) return false;
switch (event.getAction())
{
case MotionEvent.ACTION_MOVE:
params.topMargin = (int)event.getRawY();
view.setLayoutParams(params);
break;
case MotionEvent.ACTION_UP:
view.setLayoutParams(params);
break;
case MotionEvent.ACTION_DOWN:
break;
}
return true;
}
});