Próbuję utworzyć pasek akcji bez logo/tekstu aplikacji i ze scentralizowanym obrazkiem, i wiem, że jest to możliwe z niestandardowym widokiem, tutaj jest mój kod:ActionBarSherlock - Zakładki wyświetlane poniżej paska akcji z niestandardowym widokiem
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);
}
jednak kiedy ukryć logo, przesunięcia actionbar poniżej moich zakładkach tak:
ale jeśli ustawić ab.setDisplayShowHomeEnabled (true) actionbar pojawia się to właściwe miejsce (ale z logo, którego nie chcę):
Co robię źle?
Wydaje się błędem: https://github.com/JakeWharton/ActionBarSherlock/issues/327 – input
prostu próbowałem go z normalnym android actionbar i miał ten sam problem ... – AndroidNoob