W
W
Wiemo2012-09-03 20:41:47
Android
Wiemo, 2012-09-03 20:41:47

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

3 answer(s)
V
Vacxe, 2012-09-03
@Vacxe

(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.

R
Roman, 2012-09-03
@WNeZRoS

The ActionBar has a setDisplayShowHomeEnabled(boolean showHome) method that will remove the application icon.

V
Vacxe, 2012-09-03
@Vacxe

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 question

Ask a Question

731 491 924 answers to any question