Ich habe meine Actionbar, um ein title und homeAsUp zu haben, aber nicht das Logo oder das Icon.
so was:
Ich habe das versucht:
actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle("My Profile");
actionBar.setDisplayUseLogoEnabled(false);
Das Anwendungssymbol wird jedoch zwischen dem Titel und dem Pfeil nach hinten angezeigt
Danke dir
actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle("My Profile");
actionBar.setDisplayUseLogoEnabled(false);
Öffnen Sie Ihre Datei styles.xml und fügen Sie unten in Ihrem Actionbar-Stil die Codes hinzu
<item name="Android:displayOptions">showHome|homeAsUp|showTitle</item>
<item name="displayOptions">showHome|homeAsUp|showTitle</item>
<item name="Android:icon">@Android:color/transparent</item> <--this do the magic!
p/s: Ich verwende Actionbar Sherlock und das funktioniert gut
Wenn Sie nicht möchten, dass das Symbol eine bestimmte Aktivität aufweist.
getActionBar().setIcon(
new ColorDrawable(getResources().getColor(Android.R.color.transparent)));
Das Ausblenden des Aktionsleistensymbols nach folgenden Methoden funktioniert für mich
method-1:getActionBar().setIcon(Android.R.color.transparent);
method-2:getActionBar().setIcon(null);
Versuchen Sie, dieses Ding einzustellen
actionBar.setLogo(null);
getActionBar().setIcon(
new ColorDrawable(getResources().getColor(Android.R.color.transparent)));
für mich geht das.
getActionBar().setHomeButtonEnabled(true);//used to navigate to home
getActionBar().setDisplayHomeAsUpEnabled(false);//used to hide the left caret symbol
Um das Symbol auszublenden, versuchen Sie es mit setIcon(null)
.
actionBar = getSupportActionBar();
actionBar.setTitle("My Profile");
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setIcon(null);
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);