John777
John777

Reputation: 69

Action Bar not showing

I'm making some application with action bar. But when I try to run my application on my emulator I get only optional menu with items from my activity_main_actions.xml. If anybody help me what I need to do fix my problem and to get Action Bar instead of Optional Menu when I try to rum my application. This is my code:

<item
    android:id="@+id/action_search"
    android:icon="@drawable/ic_launcher_search"
    android:showAsAction="ifRoom"
    android:title="@string/action_search"/>

<!-- Location Found -->
<item
    android:id="@+id/action_location_found"
    android:icon="@drawable/ic_launcher_location_found"
    android:showAsAction="ifRoom"
    android:title="@string/action_location_found"/>

<!-- Refresh -->
<item
    android:id="@+id/action_refresh"
    android:icon="@drawable/ic_action_refresh"
    android:showAsAction="ifRoom"
    android:title="@string/action_refresh"/>

And My Main Java Class is :

public class Main extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.activity_main_actions, menu);

        return super.onCreateOptionsMenu(menu);
    }
}

Upvotes: 0

Views: 161

Answers (1)

Federico Perez
Federico Perez

Reputation: 1026

I think you confused names here. Progress bar is used for reporting/showing progress to user. While the action bar (I think this is the one you want) is a window feature for navigation, actions, etc.

I would suggest reading the following link http://developer.android.com/guide/topics/ui/actionbar.html#Adding

There you will find what is needed to add the action bar.

After that, if you need to add a Progress bar in your action bar, you need to read this tutorial:
Refresh item inside ActionBar using circular ProgressBar

Upvotes: 1

Related Questions