Reputation: 957
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?
Upvotes: 0
Views: 495
Reputation: 12672
Looking a little more deeply at the Facebook app, the bar just appears to be a LinearLayout
containing two TextView
s. 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
Reputation: 3030
Check out this library by Cyril Mottier. it was designed to do exactly what you are asking for.
Upvotes: 1
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