私は、いくつかのtextViewとボタンを含むLinearLayoutを持っています。 textViewのテキストは、ビューよりも大きいです。私の望みは、これらのテキストビューでTranslateAnimationを実行して、右からスクロールして速い速度でスクロールさせ、次に左に出すことです。ビューよりも大きいtextViewのTranslateAnimationの実行方法
問題は、テキストが最初により大きい場合、ビューよりもです。テキストは切り取られます。私は最初にこの投稿hereを見ましたが、テキストは切り取られます。私はテキストをスクロール可能にしました。ただし、実際にスクロールするのはユーザーによって異なります。私もマーキーを試しましたが、それは私が望む効果がありません。ここで
は、レイアウトのためのコードの一部です:ここで
<TextView
android:text="@string/try_your"
android:id="@+id/textView2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dip"
android:paddingBottom="25dip"
android:textSize="24sp"
android:textStyle="bold"
android:singleLine = "true"
/>
はTranslateAnimationのコードです:
public void performLineAnimation1(int fade) {
View think_you = findViewById(R.id.textView4);
TranslateAnimation slide = new TranslateAnimation(600.0f, -400.0f, 0.0f, 0.0f);
slide.setDuration(7000);
think_you.startAnimation(slide);
((TextView) think_you).setTextColor(getResources().getColor(R.color.white));
//slide.setFillEnabled(true);
}
私もonDrawを有することにより、「トリック」それをしようとしましたメソッドは、たくさんの小さなピクセル(sp)でtextViewを描画し、後でそれを拡大しますが、うまくいきません。
TranslateAnimationは私が望む効果がありますが、これを動作させることはできません。誰か提案はありますか?
ありがとうございます。
<TextView
android:text=""
android:id="@+id/textView2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dip"
android:paddingTop="25dip"
android:paddingBottom="100dip"
android:textSize="12sp"
android:singleLine = "true"
android:scrollHorizontally="true"
android:textColor="@color/clear"
/>
とJavaコード:
Animation a = AnimationUtils.loadAnimation(this, R.anim.translatescale);
Think_you.startAnimation(a);
a.setFillAfter(true);`
translatescale.xml
リック