Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:06:33+00:00 2026-06-14T20:06:33+00:00

I found some solutions for adding an animated item to a action bar using

  • 0

I found some solutions for adding an animated item to a action bar using the ActionBar Sherlock (Stackoverflow Link)

Are there any examples when just using the default Action Bar?

I tried the approach given in the link, it does create an animation for the button. THe problem is that the button is left aligned inside the action bar after the actionVIew is set.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:06:34+00:00Added an answer on June 14, 2026 at 8:06 pm

    I had to do that for a project. You just subclass ImageView and use that class as your Action View for the menu item.

    package com.---.events.android;
    
    import android.content.Context;
    import android.graphics.drawable.AnimationDrawable;
    import android.os.Handler;
    import android.util.AttributeSet;
    import android.widget.ImageView;
    
    public class AnimatedImageView extends ImageView {
    
        public AnimatedImageView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
        }
    
        public AnimatedImageView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public AnimatedImageView(Context context) {
            super(context);
        }
    
        public void initializeAnimation(){
            setImageDrawable(null);
            setBackgroundAnimation();
            AnimationDrawable da = (AnimationDrawable) getBackground();
            da.start();
        }
    
        public void setBackgroundAnimation() {
            setBackgroundResource(R.drawable.logo_animation); // this is an animation-list
        }
    
        @Override
        protected void onAttachedToWindow() {
            super.onAttachedToWindow();
            Handler handler = new Handler();
            final AnimatedImageView me = this; 
            handler.post(new Runnable(){
                public void run() {
                    me.initializeAnimation();
                }
            });
        }
    }
    

    Here’s how you specify the Action View from your menu XML.

    <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:id="@+id/menu_animation"
              android:title="test"
              android:showAsAction="always" 
              android:actionViewClass="com.--.events.android.AnimatedImageView" />
    </menu>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although I have found some solutions to this problem, none of them refer to
I've searched the Internet and have found some good solutions for teeing STDOUT to
Hi i have been looking for some solutions but i have found nothing... Is
I've found some questions here about this topic, but none of the solutions solve
I've search for some solution to my problem and I found this link .
Hi I have problem with adding javascript into a joomla module..I've found some solution,
I have found some similar Que's on SO but had not find the solution.
I found some lovely websites - http://www.mini.jp/event_campaign/big-point/ , http://www.twenty8twelve.com/ and http://www.scozzese.com - all vertical
I found some problems when implementing Jake Wharton 's ViewPagerIndicator . These are what
I found some things I want to submit a pull request for in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.