[英]How to remove Action Bar and set the custom title of FragmentActivity of Sherlock
Hello I am using Sherlock library to achieve the Tabs
. 您好,我正在使用Sherlock库来实现Tabs
。 Here I am looking to remove the ActionBar
at the top and set the custom title layout instead of it. 在这里,我希望删除顶部的ActionBar
并设置自定义标题布局,而不是它。
I achieved a functionality to add the Tabs
but could not set the custom title over ActionBar.
我实现了添加Tabs
的功能,但是无法在ActionBar.
设置自定义标题ActionBar.
Any way to do this ? 有什么办法吗?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pay_stub);
// adding action bar tabs to the activity
ActionBar mActionBar = getSupportActionBar();
Tab firstTab = mActionBar.newTab().setText(getString(R.string.paystub_current_tab)).setTabListener(this);
Tab secondTab = mActionBar.newTab().setText(getString(R.string.paystub_all_tab)).setTabListener(this);
// add the tabs to the action bar
mActionBar.addTab(firstTab);
mActionBar.addTab(secondTab);
// set the navigation mode the Action Bar Tabs
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
Thanks in advance. 提前致谢。
I resolved this by adding background color and icon of the ActionBar
. 我通过添加ActionBar
背景色和图标来解决此问题。
ActionBar actionBar = getSupportActionBar();
setTitle("");
actionBar.setIcon(R.drawable.headerlogo);
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F4A401")));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.