2017-05-20 1 views
0

을 보여, 나는 시청하기에 '안드로이드 재질 디자인'비디오 과정을 시작 developer.android.com 4 장 의미 모션 비디오는 교훈적이고 구현 라는이 동작.구현 교훈적이고 모션은 최근 텍스트 미리보기

MainActivity.java에서 :

public void onEnterAnimationComplete() { 
     super.onEnterAnimationComplete(); 
Animator animator = ObjectAnimator.ofInt(mScrollView,"scrollY",300).setDuration(400); 
     animator.start(); 
} 

activity_main.xml에서 : 여기 enter image description here

내가 지금까지 무엇을했는지이다 : 그것은 아래와 같습니다 나는 동일한 출력을 달성하기 위해 노력

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 


    <ImageView 
     android:id="@+id/full_image_view" 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     android:scaleType="centerInside" 
     /> 
<ScrollView 
    android:id="@+id/mScrollView" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:paddingTop="300dp" 
    android:layout_below="@+id/full_image_view" 
    android:elevation="8dp" 
    > 

<TextView 
    android:id="@+id/description" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/full_image_view" 
    android:fontFamily="sans-serif-condensed" 
    android:textSize="20sp" 
    android:elevation="8dp" 
    android:text="@string/sample_big_text"/> 

</ScrollView> 

</FrameLayout> 

제 질문은 출력이 다른 이유는 무엇입니까? 도움을 주시면 대단히 감사하겠습니다.

답변

1

먼저 TextView에 충분히 긴 문자열을 설정하십시오.

두 번째로 android:clipToPadding="false"을 ScrollView에 추가하십시오.

(선택 사항) ScrollView에서 TextView가 포함 된 흰색 배경 LinearLayout을 추가합니다.

+0

우선 먼저 대답 해 주셔서 감사합니다. 결과 출력에 약간의 개선이 있었지만, 제시된 XML 코드에 LinearLayout이 없기 때문에 'LinearLayout'이라고 언급 한 부분을 이해하지 못했습니다. 텍스트 상자에 흰색 배경을 추가했는데 그 결과가 만족 스러웠습니다 (첫 번째 및 두 번째 제안 사항도 구현했습니다). 텍스트가 첫 번째 위치로 돌아 가지 않는 이유를 설명해주십시오. 확실하게, 당신이 대답을 완료 한 후에이 대답을 대답으로 선택합니다. – Koorosh

+0

LinearLayout을 추가하는 이유는 배경을 제공하기 위해서입니다. TextView에 흰색 배경을 직접 추가해도 작동합니다. 텍스트가 처음으로 돌아 가지 않는다는 것은 무엇을 의미합니까? :-) –

+0

나는 애니메이션이 초기 상태로 리셋되지 않는다는 것을 의미한다. – Koorosh

관련 문제