smriti3
smriti3

Reputation: 871

How to implement actionbarsherlock

I am trying to use actionbar sherlock

I have implemented a sample project using actionbarsherlock

MainActivity.java

public class MainActivity extends SherlockActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Get the view from activity_main.xml
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // First Menu Button
        menu.add("Help")
                .setOnMenuItemClickListener(this.HelpButtonClickListener)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        // Second Menu Button
        menu.add("Like")
                .setOnMenuItemClickListener(this.LikeButtonClickListener)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        // Third Menu Button
        menu.add("Exit")
                .setOnMenuItemClickListener(this.ExitButtonClickListener)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        return super.onCreateOptionsMenu(menu);
    }
}

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/ActionBarSherlock" />

</RelativeLayout>

My Present output:: Sherlockbar is at bottom

enter image description here


What i am trying to do :: 2 sherlock bars one at top and one at bottom. both must be different bars

enter image description here

so that i can use them for different listeners

Is it possible ?

How to implement this !

Upvotes: 0

Views: 373

Answers (1)

Naddy
Naddy

Reputation: 2674

You can implement only one action bar. There is no way to implement two action bar. Except when you split action bar. Refer this link to learn more about splitting action bar.

Upvotes: 1

Related Questions