質問

I have a textView in activity_main layout with 12 lines of text. I want display 3 lines and when user touch that, then activate an animation and display all text.

the code of textView

<TextView
        android:id="@+id/instrView"
        android:inputType="textMultiLine"
        android:lines="3"
        android:typeface="monospace"
        android:textStyle="normal"
        android:onClick="onClick"
        android:clickable="true"


        android:scrollbars="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_alignParentRight="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:gravity="center"/>

i have this animation xml

   <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
        android:fillAfter="True"
        android:repeatCount="0" >

        <translate
            android:duration="@android:integer/config_mediumAnimTime"
            android:fromYDelta="+100%"
            android:toYDelta="0%" />

        <alpha
            android:duration="@android:integer/config_mediumAnimTime"
            android:fromAlpha="0.0"
            android:toAlpha="1.0" />



    </set> 

but when i call it with

final Animation anim = AnimationUtils.loadAnimation(this, R.anim.y_scale_anim);
            nav_directions = (TextView) findViewById(R.id.instrView);
            nav_directions.setText("Nopthing");

            nav_directions.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    //nav_directions.setLines(6);
                    nav_directions.startAnimation(anim);


                }
            });

then only the 3 of lines animated.

Can anyone help me? thanks in advance!

役に立ちましたか?

解決

You need to programmatically change the amount of rows of your TextView either

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top