1

でテキストを変更しようとしていますが、表示される子を でTextView.setText変更すると更新されます。また、invalidate を呼び出してみましたが、機能しません。ビューが表示された後にテキストが変更されています (invalidate をすぐに呼び出す必要はありません)。ViewFlippersetDisplayedChild

コード:

TextView text = (TextView) findViewById(R.id.summary);
text.setText( /* text here */ );
flipper.setDisplayedChild(NUMBER);

これらはすべて UI スレッドで呼び出されると思います。

どうすればこれを修正できますか?

4

1 に答える 1

0

私は解決策を見つけました。テキストビューを別のコンテナに入れます.このように

そしてOncreateメソッドで

newsFeedTextView.setSelected(true); 

それは挑戦的に機能します.enjoy

<LinearLayout
    android:id="@+id/newsLayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true" >

    <TextView
        android:id="@+id/newsFeedTextView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/splash_bg"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:freezesText="true"
        android:marqueeRepeatLimit="marquee_forever"
        android:padding="10dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="Manchester United boss David Moyes is from the Champions League."
        android:textColor="@android:color/white"
        android:textStyle="bold" />
      </LinearLayout> 
于 2014-04-04T11:08:31.580 に答える