Define a custom ActionBar Of title, And add a overflow Of Action   Item.

Code implementation as follows   :

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.SubMenu; public class MainActivity extends SherlockActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
} private void initActionBarTitle() {
// You can customize actionbar
// be not in actionbar Show logo
View mainActionBarView = LayoutInflater.from(this).inflate(R.layout.main_action_bar, null);
getSupportActionBar().setCustomView(mainActionBarView); } @Override
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) { MenuItem search = menu.add(0, 1, 2, "share");
search.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); SubMenu addMenu = menu.addSubMenu(0, 2, 3, "overflow");
addMenu.add(0, 3, 0, " Replace the topic ");
addMenu.add(0, 4, 0, " System settings ");
addMenu.add(0, 5, 0, " Change Password ");
addMenu.add(0, 6, 0, " change the avatar "); MenuItem overFlowItem = addMenu.getItem();
overFlowItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu);
} @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case 1:
Toast.makeText(MainActivity.this, " Share ", Toast.LENGTH_SHORT).show();
break; case 3:
Toast.makeText(MainActivity.this, " Replace the topic ", Toast.LENGTH_SHORT).show();
break; case 4:
Toast.makeText(MainActivity.this, " System settings ", Toast.LENGTH_SHORT).show();
break; case 5:
Toast.makeText(MainActivity.this, " Change Password ", Toast.LENGTH_SHORT).show();
break; case 6:
Toast.makeText(MainActivity.this, " change the avatar ", Toast.LENGTH_SHORT).show();
break; }
return super.onOptionsItemSelected(item);

design sketch as follows :

ActionBarSherlock Learning notes of ( 3、 ... and ) ------------ ActionBarSherlock Medium overflow And item More articles about click events

  1. qml Learning notes ( Two ): Visual element base class Item Detailed explanation ( In the first half anchors wait )

    The original blogger's blog address : This article blog address : ...

  2. Oracle Learning notes 3 SQL command

    SQL brief introduction SQL The following types of commands are supported : 1. Data definition language (DDL) 2. Data manipulation language (DML) 3. Transaction control language (TCL) 4. Data control language (DCL)  

  3. [Firefly engine ][ Learning notes 3 ][ It's over ] Required module encapsulation

    The original address : Learning notes one portal learning notes two portal Study notes three guide reading :        Note 3 is the encapsulation of each module , Post here ...

  4. JSP Learning notes ( 3、 ... and ): ordinary Tomcat Web The server

    Be careful : Every time the Tomcat After the configuration file is modified , Must restart Tomcat stay E Discoid DATA Create in folder TomcatDemo Folder , And will Tomcat Under the installation path webapps/ROOT Medium WEB-INF Folder copy ...

  5. java And jvm Learning notes 3 (Class File checker )

    java And jvm Learning notes 3 (Class File checker ) We have learned from the previous study class The file is loaded by the class loader , But loading class Before or after the document ,class The file actually needs to be verified , That's the theme of today's study ,cl ...

  6. VSTO Learning notes ( 3、 ... and ) Development Office 2010 64 position COM add-in

    original text :VSTO Learning notes ( 3、 ... and ) Development Office 2010 64 position COM add-in One . Introduction to add ins Office There are many ways to extend Office Patterns of application functionality , Common are : 1.Office Automation program (A ...

  7. Java IO Learning notes 3

    Java IO Learning notes 3 Throughout IO In bag , In fact, it is divided into byte stream and character stream , But apart from these two streams , There is also a set of byte streams - Character stream conversion class . OutputStreamWriter: yes Writer Subclasses of , Will output ...

  8. NumPy Learning notes 3、 ... and Stock price

    NumPy Learning notes 3、 ... and Stock price <NumPy Learning notes > The series will record learning NumPy Hands on notes in the process , The early reference book is <Python Basic course of data analysis NumPy Learning Guide > The second edition .&l ...

  9. Typescript Learning notes 3 : function

    Chinese net : Official website : Catalog : Typescript Study note 1 : Introduce . install . compile Typescrip ...

Random recommendation

  1. C# to PDF Add text and picture headers to the document

    A header is often used to display additional information about a document , We can insert text or graphics in the header , for example , Page number . date . company logo . Document title . File name or author name and so on . So how do we add headers programmatically ? today , This article will share with you how to use the free component ...

  2. About “ Invalid inter thread operation : Never create controls ’textBox1‘ Thread access it ” Solutions to exceptions

    Invalid inter thread operation : Never create controls “textBox1” Thread access it background : Assign a value calculated by a worker thread to textBox1.text; terms of settlement :1. Add... Directly to the constructor of the form :System.Window ...

  3. [ Paid video ]Delphi video Android Development uses static libraries (A) Dynamic library (SO)

    About this video : I got a commission a while ago , solve Delphi Development Android The problem of serial communication in the program , The manufacturer provides c file , It needs to be translated into delphi You can use , Translation is relatively simple . But later translation, reading and writing ic I can't go on with the card unit ...

  4. windows bat Script implementation ftp Automatic download Delete

    Now there is a need to put the image under a remote file , Download to local , And delete the downloaded file , And the image in the remote directory will increase at any time . Imagine if all the scripts are written , Then you need to call windows The scheduled tasks on are executed regularly ...

  5. ZOJ3784 String of Infinity Tall AC automata The data is so watery ! Not counting input and output, only 5-7 That's ok

    Find the given s In the assembly word All of the same character , In this way word There are several , If the quantity <m Just yes, Otherwise, no.#include<iostream> #include<cstring> ...

  6. software project( two )—— software project

        The first chapter of every book , It's all about macro things . Soft work is no exception . Next . We're going to talk about software project" What is it? " The problem of . One . What is it? ? watermark/2/text/aHR0cDov ...

  7. kettle Connect Hadoop Copy *-site.xml Cluster ...

  8. window.onload Load and $(document).read()

    1. Execution opportunity : window.onload : You have to wait until all the content in the web page is loaded . $(document).read(): All of the DOM After the execution of the structure . Probably DOM The element is not loaded . 2. Single network ...

  9. springboot-helloworld

    1 Use idea establish springboot The project is shown in the following figure And select web modular 2, Sign in springboot Official website Introduce dependency packages such as ...

  10. Webpack+Vue How to import Jquery and Jquery Third party plug-ins for

    Create a jquery-vendor.js file import $ from 'jQuery'; console.log($); window.$ = $; window.jQuery = $; expo ...