2014-12-05 5 views
5

나는 앱을 만들고 있습니다. 로그인 화면에는 bcakground 이미지가 있습니다. 이 배경 이미지를 왼쪽에서 오른쪽으로 이동하고 싶습니다.이 작업을 수행 할 수 있습니까?배경 이미지가 왼쪽에서 오른쪽으로 이동

샘플 코드는 사용하고 있지만 이미지가 이동되어 레이아웃이 그대로 남아 있습니다. 나는 그것을 원하지 않는다.

ImageView img_animation = (ImageView) findViewById(R.id.img_animation); 

    TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f, 
      0.0f, 0.0f); 
    animation.setDuration(5000); 
    animation.setRepeatCount(5); 
    animation.setRepeatMode(2); 
    animation.setFillAfter(true); 
    img_animation.startAnimation(animation); 

난 그냥이 응용 프로그램 화면 등 구현하려는 : 장치

확인이 application 로그인 화면을. 로그인 화면에는 배경 이미지가 있습니다. 이 이미지는 왼쪽에서 오른쪽으로 이동합니다. 이 과정을 어떻게 성취 할 수 있습니까? 저를 도와주세요.

enter image description here

+1

Plz 사용자 정의 배경을 추가 한 코드를 보여줍니다. –

답변

2

당신은 matrix를 사용하려고 할 수 있습니다.

은 ImageView의 scaleType을 매트릭스로 설정합니다.

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:scaleType="matrix" /> 

그런 다음 ImageView에서 사용하는 행렬을 매 밀리 초마다 조금씩 변환합니다.

Matrix matrix = new Matrix(); 
matrix.postTranslate(x, y); 
img_animation.setImageMatrix(matrix); 
관련 문제