Hi I am trying to develop a custom lock screen in which I want to replace the slide to unlock with a ImageView as shown in the image.
This what I have tried so far.
I have placed an Image in the left corner of the screen and used onTouchListner to drag the Image horizontally Code below.
left_Locker.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
int eid = event.getAction();
switch (eid) {
case MotionEvent.ACTION_DOWN:
toastText.setVisibility(View.VISIBLE);
toastText.setTextColor(Color.BLACK);
toastText.setText("Slide to Unlock");
break;
case MotionEvent.ACTION_MOVE:
RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) left_Locker.getLayoutParams();
int x = (int) event.getRawX();
mParams.leftMargin = x - 50;
left_Locker.setLayoutParams(mParams);
break;
case MotionEvent.ACTION_UP:
toastText.setVisibility(View.GONE);
break;
default:
break;
}
return true;
}
});
The Image does move horizontally but What I am looking is to get the Image background also to drag as shown in the picture above. Am I on the right track by using a ImageView ??
Below is the Image what I have tried.
I can move the Image horizontally but how to get the background as I scroll ??