2016-10-27 3 views
0

내 사용자 지정보기에 올 때 나는 애니메이션 처리에 약간의 혼란을 겪고 안드로이드.애니메이션 -

public class ConcreteView extends RelativeLayout { 
     //blah blah code 
     public ConcreteView(Context context, AttributeSet attrs) { 
      //blah blah code 
     } 
     //blah blah code 
} 

이 같은 XML : 지금은을 찾고 있어 무엇

<com.package.ConcreteView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="#ffffff" 
    android:id="@+id/suggest" 
    app:headerText="This is a custom view. Animations yet to be implemented" 
    app:headertextColor="#212121" 
    app:footerText="Frostbite engine" 
    app:footertextColor="#424242" 
    app:footertextSize="9" 
    app:headerTextFontSize="13"/> 

을 모두 구현하는 방법입니다 내가 지금 봉착하는 것은이 같은 클래스입니다 이 클래스 (프로그래밍) 그냥 ConcreteView 인스턴스를 확인하고 setAnimation 방법을 액세스 할 수 있도록 내부 (fadeIn, 페이드/아웃 등으로 슬라이딩 같은) 기본 애니메이션. 어떤 아이디어?

감사합니다, 샨

답변

0

사용자 지정보기의 구현 내부, 당신은 항상보기와 this 연산자를 사용하여 뷰 기능에 액세스 할 수 있습니다. 이를 사용하면 애니메이션 당 뷰의 속성을 변경할 수 있어야합니다.

그래서,

public class ConcreteView extends RelativeLayout { 
     //blah blah code 
     public ConcreteView(Context context, AttributeSet attrs) { 
      //blah blah code 
     } 
     //blah blah code 

     public void blahAnimationFadeOut(){ 
      this.setAlpha(0.5); // dummy example to access all view functions, assuming you can write your own animations programatically 
     } 
} 
+0

고마워요 같은 것이다 : – Han