Answer the question
In order to leave comments, you need to log in
How to remove the application icon from the title of an Activity?
Actually a subject.
Is it possible to remove the application icon from the title of an Activity? I tried to play with the themes, but something did not like it. We need a simple solution.
Answer the question
In order to leave comments, you need to log in
(With a preliminary check of versions. It does not work in 2.3, you need to skip the action, because there were no actionbars then)
1) Set the icon getActionBar().setIcon(Bitmap icon); Upload a 1px icon with transparent color
2) A simple straight-forward solution.
-Disable in OnCreate activity ActionBar
getActionBar().hide();
-In the layout, which in setContentView you add the top layout with layout_height = "50dp" and layout_wigth = "fill_parent" and set the backgound to any color.
Hope it helped. Good luck.
The ActionBar has a setDisplayShowHomeEnabled(boolean showHome) method that will remove the application icon.
Checking the Android version + disabling the Actionbar for step 2 (Similarly, replacing the icon with 1px)
protected void onCreate(Bundle savedInstanceState) {
if (isHighVersionOs())
getActionBar().hide();
setContextView(R.layout.ваш лайаут)
super.onCreate(savedInstanceState);
}
private boolean isHighVersionOs() {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question