2016-10-02 4 views
0

나는 안드로이드 애니메이션에 익숙하지 않다. 안드로이드에서 편집 텍스트의 하단 라인 애니메이션을 구현하고 싶다. 초점이 이메일 필드에있을 때, 포커스가 패스워드 필드로 간다. 안드로이드 텍스트의 하단 라인 애니메이션에 애니메이션을 편집하고 아래에 표시된 패스워드 field.as 아래에 간다. 나는 패스 애니메이션을 사용하여 시도했지만, 원형 경로로 경로 애니메이션의 라인을 애니메이션하는 방법을 모르겠다. 제발 도와주세요. 미리 감사드립니다. enter image description hereandroid animation : animate line

답변

0

어쩌면 안드로이드 벡터를 사용하는 좋은 방법이 될 것입니다 안드로이드 - pathview의 애니메이션 드로어 블 하나의 레이아웃 내부에 로그인과 암호를해야합니다,이 당김 애니메이션이 레이아웃의 배경으로 될 것 https://github.com/geftimov/android-pathview

0

이러한 애니메이션은 벡터 기반 드로어 블 android를 사용하여 입니다. 특히 SVG (확장 가능한 벡터 그래픽).

경로 데이터와 단순히 XML 파일이며, 그 후는 원하는 애니메이션을 달성하기 위해 개체 애니메이터를 사용하여 값을 조작 할 수있다. 마지막으로 다른 드로어 블 xml과 연결하십시오.가 // 예

XML 벡터 경로 데이터 파일

<?xml version="1.0" encoding="utf-8"?> 
<vector xmlns:android="http://schemas.android.com/apk/res/android" 
android:viewportWidth="170" 

android:viewportHeight="170" 

android:width="500dp" 

android:height="500dp"> <path 

android:name="head" 

android:fillColor="@color/ 

android_green" 

android:pathData="M85,40 c10,0 20,0 30,0 c0,-5 -10,-20 -30,-20 c-20,0 -30,15 -30,20 c10,0 20,0 30,0"/> 
</vector> 

// 예 오브젝트 애니메이션 파일

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android"> 
<objectAnimator android:duration="@integer/morphing_time" 

android:propertyName="pathData" 

android:valueType="pathType" 

android:valueFrom="M85,40 c10,0 20,0 30,0 c0,-5 -10,-20 -30,-20 c-20,0 -30,15 -30,20 c10,0 20,0 30,0" 

android:valueTo="M108,35 c5.587379,-6.7633 9.348007,-16.178439 8.322067,-25.546439 c-8.053787,0.32369 -17.792625,5.36682 -23.569427,12.126399 c-5.177124,5.985922 -9.711121,15.566772 -8.48777,24.749359 c8.976891,0.69453 18.147476,-4.561718 23.73513,-11.329308"/> 

<objectAnimator 

android:duration="@integer/morphing_time" 

android:propertyName="fillColor" 

android:valueFrom="@color/ 

android_green" 

android:valueTo="@color/apple_black" /> 
</set> 

// 지금처럼 애니메이션 : 여기

샘플 구현 드로어 블 폴더 안에있는이

<?xml version="1.0" encoding="utf-8"?> <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" 

android:drawable="@drawable/ 

android_logo_vector_morphable"> 

<target android:animation="@animator/head_leaf_transition" 

android:name="head"/> 
</animated-vector> 

출처 :Lewis Mac Geary

이 정보가 당신에게 도움이되는지 알려 마십시오.