Hi. I had this problem the other day, and I solved it with the
following code. I don't know if there's a more 'official' way of doing
it, but it worked for me.

TextView t1 = (TextView) mSwitcher.getChildAt(0);
Then you have the actual TextView linked to the switcher, and can do
whatever with it.

On Jun 7, 3:01 pm, didihome <[email protected]> wrote:
> dear all
> i have a trouble in TextSwitcher , there are simple code from the api
> demo
>
>     protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>
>         setContentView(R.layout.text_switcher_1);
>
>         mSwitcher = (TextSwitcher) findViewById(R.id.switcher);
>         mSwitcher.setFactory(this);
>
>         Animation in = AnimationUtils.loadAnimation(this,
>                 android.R.anim.fade_in);
>         Animation out = AnimationUtils.loadAnimation(this,
>                 android.R.anim.fade_out);
>         mSwitcher.setInAnimation(in);
>         mSwitcher.setOutAnimation(out);
>
>         Button nextButton = (Button) findViewById(R.id.next);
>         nextButton.setOnClickListener(this);
>
>         updateCounter();
>     }
>
>     public void onClick(View v) {
>         mCounter++;
>         updateCounter();
>     }
>
>     private void updateCounter() {
>         mSwitcher.setText(String.valueOf(mCounter));
>     }
>
>     public View makeView() {
>         TextView t = new TextView(this);
>         t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
>         t.setTextSize(36);
>
>         return t;
>     }
>
> i want change the textcolor or textsize whe i click the button,  how
> can i do? thx a lot .

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to