Giter Site home page Giter Site logo

actionbardemo's Introduction

ActionBarDemo

actionBar的教程

1.获得ActionBar | link

//  获得ActionBar
ActionBar actionBar = getSupportActionBar();

2.显示/隐藏ActionBar | link

//显示ActionBar
actionBar.show();
//隐藏ActionBar
actionBar.hide();

3.设置ActionBar 的背景颜色| link

Drawable drawable=getResources().getDrawable(R.drawable.actionbar_bg);
//设置ActionBar的背景
actionBar.setBackgroundDrawable(drawable);

4.设置ActionBar 的Back| link

//设置返回键
actionBar.setDisplayHomeAsUpEnabled(true);

5.设置ActionBar Back的返回事件| link

@Override
public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()){
       case android.R.id.home:{
            onBackPressed();
            break;
       }
   }
   return true;
}

actionbardemo's People

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.