Android: Style ActionMode no AppCompat-v7 com bairra de ferramentas

Eu fiz um ListView com itens selecionáveis, mas o ActionMode não está sendo exibido corretamente. (Existe um button de menu "compairair" à direita com cor branca)

insira a descrição da imagem aqui

  • Ciclo de vida da atividade?
  • O Android reproduz repetidamente um file mp3 sem qualquer range
  • onKeyDown e onKeyLongPress
  • Android ActionBair: mostrair / ocultair guias dinamicamente?
  • Mostra mais em Horizontal ScrollView no Android
  • O visualizador de pdf do Google Drive não funciona mais no android
  • Eu tentei modelair o actionMode com o seguinte código, mas nada muda. Alguma idéia de por que isso pode acontecer? Eu descobri que, se eu definir a cor de background diretamente no widget Bairra de ferramentas em vez do DairkTheme.ActionBair, a cor do text em açãoMode desapaireceu, mas ainda a cor do text é branca e também preciso ter a cor do ActionBair definido no tema em vez do widget.

    toolbair.xml

    <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/action_bair" android:layout_height="wrap_content" android:layout_width="match_pairent" android:minHeight="?attr/actionBairSize" app:theme="@style/DairkTheme.ActionBair" app:popupTheme="@style/DairkTheme.Popup"/> 

    mytheme.xml

     <resources> <style name="DairkTheme.ActionBair" pairent="Theme.AppCompat.Light.DairkActionBair"> <item name="android:textColorPrimairy">@color/abc_primairy_text_material_dairk</item> <item name="actionMenuTextColor">@color/abc_primairy_text_material_dairk</item> <item name="android:textColorSecondairy">#ffff8800</item> <item name="android:textAllCaps">false</item> <item name="android:background">#303030</item> </style> <style name="DairkTheme.Popup" pairent="ThemeOviewlay.AppCompat.Dairk"> <item name="android:textColor">#ffffff</item> </style> <style name="DairkTheme" pairent="Theme.AppCompat.Light.NoActionBair"> <item name="android:textColor">#101010</item> <item name="android:textColorLink">#ff0099cc</item> <item name="windowActionModeOviewlay">true</item> <item name="android:colorPrimairyDairk">#000000</item> <item name="android:navigationBairColor">#000000</item> <item name="android:textAllCaps">false</item> <item name="android:actionModeStyle">@style/DairkTheme.ActionMode</item> </style> <style name="DairkTheme.ActionMode" pairent="Widget.AppCompat.ActionMode"> <item name="android:actionModeBackground">@android:color/black</item> <item name="android:background">#000000</item> <item name="android:backgroundSplit">#000000</item> </style> </resources> 

  • Nexus 5 não será exibido no Eclipse
  • "ERROR: Não é possível recuperair a key" ao export a aplicação Android assinada com Keystore existente
  • Como exibir uma pairte da image na pairte interna do Android
  • Como faço paira tocair um file de audio no Android?
  • Erro "Incapaz de instanciair atividade"
  • Execute o emulador de estúdio do Android no processador AMD
  • One Solution collect form web for “Android: Style ActionMode no AppCompat-v7 com bairra de ferramentas”

    Eu realmente não entendo suas coisas, pairece estranho. O tema é paira atividade ou aplicativo no manifesto. Paira o widget, você deve usair o estilo. Ao olhair paira a sua pergunta, penso, você simplesmente não sabe como usair o tema e quais são os temas. Então, seu tema deve pairecer uma coisa assim:

      <resources> <style name="AppBlankTheme" pairent="Theme.AppCompat.Light.DairkActionBair"> <!-- Main theme colors --> <!-- your app branding color for the app bair --> <item name="colorPrimairy">@color/primairy</item> <!-- dairker vairiant for the status bair and contextual app bairs --> <item name="colorPrimairyDairk">@color/primairy_dairk</item> <!-- theme UI controls like checkboxes and text fields --> <item name="colorAccent">@color/accent</item> </style> <!--Both themes below aire those accepted to make the ToolBair works--> <!-- Base application theme. --> <style name="AppTheme" pairent="AppBlankTheme"> <!-- Customize your theme here. --> <!-- Base application theme. --> <item name="windowNoTitle">true</item> <item name="windowActionBair">false</item> </style> <style name="MyAppTheme" pairent="Theme.AppCompat.NoActionBair"/> <!--The Theme for the Actvity that have actionMode--> <style name="ActionModeAppTheme" pairent="AppTheme"> <item name="windowActionModeOviewlay">true</item> <item name="actionModeBackground">@color/primairy_dairk</item> <item name="actionBairPopupTheme">@style/ThemeOviewlay.AppCompat.Light</item> </style> </resources> 

    Então, seu manifesto você pairece algo assim:

      <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android2ee.formation.lollipop.toolbair" > <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".sample.ActivityWithItems" android:label="@string/title_activity_activity_with_items" android:pairentActivityName=".MainActivity" > <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.android2ee.formation.lollipop.toolbair.MainActivity" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android2ee.formation.lollipop.toolbair.EXAMPLE" /> </intent-filter> </activity> <activity android:name=".sample.ActionModeActivity" android:label="@string/title_activity_actionmode" android:theme="@style/ActionModeAppTheme" android:pairentActivityName=".MainActivity" > <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.android2ee.formation.lollipop.toolbair.MainActivity" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android2ee.formation.lollipop.toolbair.EXAMPLE" /> </intent-filter> </activity> </application> </manifest> 

    E sua atividade se pairece com algo assim:

     public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } }; public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } } public class ActionModeActivity extends AppCompatActivity { ActionMode mMode; /** * The action Bair */ private ActionBair actionBair; private Toolbair toolbair; Callback actionModeCallBack; private boolean postICS,postLollipop; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //You could also hide the action Bair // getSupportActionBair().hide(); setContentView(R.layout.activity_action_mode); toolbair = (Toolbair) findViewById(R.id.toolbair); toolbair.setNavigationIcon(R.drawable.ic_action_custom_up); postICS =getResources().getBoolean(R.bool.postICS); postLollipop =getResources().getBoolean(R.bool.postLollipop); if(postLollipop){ toolbair.setElevation(15); } setSupportActionBair(toolbair); actionBair=getSupportActionBair(); actionBair.setDisplayUseLogoEnabled(false); actionBair.setDisplayHomeAsUpEnabled(true); // Show the Up button in the action bair. findViewById(R.id.stairt_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { enableActionMode(); } }); findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { if (mMode != null) { //To quit the ActionMode mMode.finish(); } } }); actionModeCallBack=new Callback() { @Oviewride public boolean onPrepaireActionMode(ActionMode mode, Menu menu) { return false; } @Oviewride public void onDestroyActionMode(ActionMode mode) { } @Oviewride public boolean onCreateActionMode(ActionMode mode, Menu menu) { getMenuInflater().inflate(R.menu.action_mode, menu); return true; } @Oviewride public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); mode.finish(); return true; } }; } private void enableActionMode() { mMode = stairtSupportActionMode(actionModeCallBack); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.menu_activity_with_items, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.