Tôi đang cố gắng tạo thanh tác vụ không có biểu tượng/văn bản ứng dụng và với hình ảnh tập trung và tôi biết có thể có chế độ xem tùy chỉnh, đây là mã của tôi:ActionBarSherlock - Tab xuất hiện thanh hành động ABOVE với chế độ xem tùy chỉnh
protected void initActionBar()
{
RelativeLayout custom = new RelativeLayout(getApplicationContext());
ActionBar.LayoutParams params = new ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
custom.setLayoutParams(params);
custom.setGravity(Gravity.CENTER);
custom.setBackgroundDrawable(getResources().getDrawable(R.drawable.background_grad_grey_rounded));
ImageView image =new ImageView(getApplicationContext());
image.setBackgroundResource(R.drawable.ic_launcher);
custom.addView(image);
ab = getSupportActionBar();
ab.setDisplayShowCustomEnabled(true);
ab.setCustomView(custom);
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
tab_connect = ab.newTab();
tab_connect.setText("CONNECT");
tab_connect.setTabListener(this);
tab_discover = ab.newTab();
tab_discover.setText("DISCOVER");
tab_discover.setTabListener(this);
tab_simplify= ab.newTab();
tab_simplify.setText("SIMPLIFY");
tab_simplify.setTabListener(this);
ab.addTab(tab_simplify);
ab.addTab(tab_discover);
ab.addTab(tab_connect);
ab.setDisplayShowTitleEnabled(false);
ab.setDisplayShowHomeEnabled(false);
}
tuy nhiên khi tôi ẩn logo, sự thay đổi actionbar bên dưới các tab của tôi như vậy:
nhưng nếu tôi đặt ab.setDisplayShowHomeEnabled (true) các actionbar xuất hiện trong đó là đúng nơi (nhưng với biểu trưng mà tôi không muốn):
Tôi đang làm gì sai?
Có vẻ như một lỗi: https://github.com/JakeWharton/ActionBarSherlock/issues/327 – input
Chỉ cần thử nó với actionbar android bình thường và có cùng một vấn đề ... – AndroidNoob