구글링을 해보니
Viewflipper나 Pager가 제가 원하는 외형을 가지고 있는데요
둘다 xml에 있는 모양을 좌우 스크롤 할 수 있더라구요 ...
근데 제가 원하는건 두개의 액티비티를 좌우 스크롤 할 수 있도록 구현하는 것입니다...
액티비티1 >>>>스크롤>>>>액티비티2 이런식으로요 ....
아시는분 조언 좀 부탁드립니다 .... ㅠㅠ
음 편법이 있긴합니다.
엑티비티간에 전환할때에 에니메이션을 줘서
overridePendingTransition(R.anim.right_in, R.anim.right_out);
스크롤하는 듯한 느낌을 주면되고요
스크롤 이벤트는 onTouch로이벤트를 받아서 처리하면될것같습니다.
엑티비티1 부분
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
touchX = event.getX();
} else if (action == MotionEvent.ACTION_UP) {
if (event.getX() > touchX + calWidth(100)) {
Intent intent = new Intent(this, LevelActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.left_in, R.anim.left_out);
}
return true;
엑티비티2부분
if (event.getX() < touchX - calWidth(100)) {
finish();
답변 너무너무 감사드립니다 ^^
로그인 유지
음 편법이 있긴합니다.
엑티비티간에 전환할때에 에니메이션을 줘서
overridePendingTransition(R.anim.right_in, R.anim.right_out);
스크롤하는 듯한 느낌을 주면되고요
스크롤 이벤트는 onTouch로이벤트를 받아서 처리하면될것같습니다.
엑티비티1 부분
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
touchX = event.getX();
} else if (action == MotionEvent.ACTION_UP) {
if (event.getX() > touchX + calWidth(100)) {
Intent intent = new Intent(this, LevelActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.left_in, R.anim.left_out);
}
}
return true;
}
엑티비티2부분
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
touchX = event.getX();
} else if (action == MotionEvent.ACTION_UP) {
if (event.getX() < touchX - calWidth(100)) {
finish();
overridePendingTransition(R.anim.right_in, R.anim.right_out);
}
}
return true;
}