Actionbar

ActionbarSherlock支持android2.x版本

简称abs

概念:增强型Titlebar


使用步骤:

1) 继承SherlockActivity

2) 将导入的包(import android.view.Menu)修改为:import com.actionbarsherlock.view.Menu;

将getMenuInflater()改为getSupportMenuInflater()

3) 设置Actionbar属性

ActionBar actionBar = getSupportActionBar();

actionBar.setTitle("多贝");

actionBar.setLogo(R.drawable.ic_launcher);

actionBar.setDisplayHomeAsUpEnabled(true)

4) 为了兼容Android2.x,必须在清单中设置主题

@style/Theme.Sherlock.Light.DarkActionBar