Adam
Adam

Reputation: 957

How do I make an action bar feature from the facebook app?

This is a picture of the facebook app from the play store. I would like to copy the part that says "New Stories 10+" in my app. How do I make that? Is that part of the action bar?

I read through the action bar documentation here but couldn't find anything about it. I'm having trouble doing a google search for it too because I don't know what it's called.

Also, if you open the facebook app when you're in airplane a very similar type of message comes up that says "No Internet Connection". How is that message created?

enter image description here

Upvotes: 0

Views: 495

Answers (3)

Oleg Vaskevich
Oleg Vaskevich

Reputation: 12672

Looking a little more deeply at the Facebook app, the bar just appears to be a LinearLayout containing two TextViews. This layout is then just embedded in the news feed fragment and hidden/shown as needed. In other words, it's not a part of the action bar; it's just a normal view within the fragment.

Upvotes: 2

Qw4z1
Qw4z1

Reputation: 3030

Check out this library by Cyril Mottier. it was designed to do exactly what you are asking for.

Upvotes: 1

akemalFirdaus
akemalFirdaus

Reputation: 606

Yes it is part of the ActionBar but only if the device or emulator is on API 3.0 and higher. if the device or emulator has a lower API level, the actions will appear on the menu button.

This is just a dummy but it will give you a rough idea.

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    int groupid = 1;

    menu.add(groupid, 1, 1, "Search").setIcon(R.drawable.embassy_default);
    // menu.add(groupid, , ,"Back").setIcon(R.drawable.hospital_default);
    menu.add(groupid, 1, 1, "Exit").setIcon(R.drawable.government_default);

    return true;

}

Read more here

http://developer.android.com/guide/topics/ui/menus.html

Upvotes: 0

Related Questions