Blinking Text in android view

Viewed 48308

How do I display Blinking Text in android.

Thank you all.

7 Answers
 public static void blinkText(TextView textView) {
    Animation animation = new AlphaAnimation(1, 0);         // Change alpha from fully visible to invisible
    animation.setDuration(300);                             // duration - half a second
    animation.setInterpolator(new LinearInterpolator());    // do not alter animation rate
    animation.setRepeatCount(-1);                            // Repeat animation infinitely
    animation.setRepeatMode(Animation.REVERSE);             // Reverse animation at the end so the button will fade back in
    textView.startAnimation(animation);
}

I can't remember where I found this but it is by far the best I've seen

    private bool _blink; 
    private string _initialtext;
    private async void Blink()
    {
        _initialtext = _txtView.Text;
        _txtView.Text = Resources.GetString(Resource.String.Speak_now);
        while (VoiceRecognizerActive)
        {
            await Task.Delay(200);
            _blink = !_blink;
            Activity.RunOnUiThread(() =>
            {
                if (_blink) 
                    _txtView.Visibility = ViewStates.Invisible; 
                else 
                    _txtView.Visibility = ViewStates.Visible; 
            }); 
        }
        _txtView.Text = _initialtext;
        _txtView.Visibility = ViewStates.Visible;
    }

//this is for Xamarin android

Related