2012-08-16 1 views
0

두 개의 ImageView가 있는데, 하나씩 페이드 아웃하고 다른 페이드로 페이드하려고합니다.안드로이드 ImageViews on the othert/fade in fade out

문제는 서로 위에 놓아야한다는 것입니다.

<RelativeLayout 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" > 

<ImageView 
android:id="@+id/imageView1" 
android:layout_width="124dp" 
android:layout_height="94dp" 
android:src="@drawable/dgreen" 
android:visibility="visible" /> 

<ImageView 
android:id="@+id/imageView" 
android:layout_width="124dp" 
android:layout_height="94dp" 
android:src="@drawable/blank" /> 
</RelativeLayout> 

Animation animation = AnimationUtils.loadAnimation(this.getApplicationContext(),R.anim.fade_out); 
animation.setFillAfter(true); 
Animation animation1 = AnimationUtils.loadAnimation(this.getApplicationContext(),R.anim.fade_in); 
animation1.setFillAfter(true); 
iV.startAnimation(animation); 

iV1.startAnimation(animation1); 

그러나 첫 번째 이미지 뷰 아래의 그림은 "빛나지 않습니다".

편집 : 나는 알파 변환을 사용

<?xml version="1.0" encoding="utf-8"?> 
<alpha xmlns:android="http://schemas.android.com/apk/res/android" 
android:interpolator="@android:anim/accelerate_interpolator" 
android:fromAlpha="1.0" android:toAlpha="0.0" 
android:duration="1000" /> 

<?xml version="1.0" encoding="utf-8"?> 
<alpha xmlns:android="http://schemas.android.com/apk/res/android" 
android:interpolator="@android:anim/accelerate_interpolator" 
android:fromAlpha="0.1" android:toAlpha="1.0" 
android:duration="1000" /> 

: 다음은 인/아웃 코드 내 페이드입니다.

+0

같은 애니메이션을 적용하고 애니메이션을 페이드 아웃 수 있을까? 알파 애니메이션을 사용하여 투명하게 만드십니까? – vallllll

+0

예 알파 애니메이션을 사용하여 한 그림을 투명하게 만들고 다른 그림을 투명에서 불투명으로 만듭니다. –

답변

0

당신은 FrameLayout이 사용하고 here처럼 중력으로 재생하고 fade_in의 코드가 무엇 here