Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android action bar like twitter sample

What is the best way to implement action bar like twitter sample UI Pattern.

Twitter for Android: A closer look at Android’s evolving UI patterns Pattern 4: Action Bar http://android-developers.blogspot.com/2010/05/twitter-for-android-closer-look-at.html

like image 816
Baris Avatar asked May 24 '10 21:05

Baris


People also ask

How can I customize my action bar in Android?

This example demonstrate about how to create a custom action bar in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How will you replace a menu with action bar in Android?

To replace an app's default action bar with a Toolbar : Create a new custom theme and modify the app's properties so that it uses this new theme. Disable the windowActionBar attribute in the custom theme and enable the windowNoTitle attribute. Define a layout for the Toolbar .

What is the action bar in Android?

Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.

What is the difference between toolbar and action bar in Android?

What is the difference between the toolbar and the action bar? The most obvious difference between the two is the updated visual design of the toolbar. The toolbar no longer includes an icon on the left side and decreases some of the spacing between the action items on the right side.


1 Answers

Yet another action bar implementation can be found here (shameless plug), https://github.com/johannilsson/android-actionbar. It's implemented as a library project so there's no need to copy-paste resources.

Implementation wise it's built as a widget that extends a RelativeLayout with it own layout for the actions and the bar. This makes it possible to add it to layouts with it own xml snippet.

<com.markupartist.android.widget.ActionBar     android:id="@+id/actionbar"     style="@style/ActionBar"     /> 

And then later on refer to it in a activity to add actions.

ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar); actionBar.setTitle("Other"); actionBar.setHomeAction(new IntentAction(this, HomeActivity.createIntent(this), R.drawable.ic_title_home_default)); actionBar.addAction(new IntentAction(this, createShareIntent(), R.drawable.ic_title_share_default)); actionBar.addAction(new ToastAction()); 
like image 83
Johan Berg Nilsson Avatar answered Sep 20 '22 18:09

Johan Berg Nilsson