Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can not remove title bar in Activity

i want to remove title on top of my Activity. i tried this two way they work but not in api level 8.

1:

<style name="NOtitleTheme" parent="Theme.AppCompat.Light">
<item name="android:windowFullscreen">true</item>
   <item name="android:windowNoTitle">true</item> </style>

2:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

any idea why this does not work on api 8?

once i managed to remove it in api 8, but i do not remember how.


EDIT:

Solved! the problem was this.requestWindowFeature(Window.FEATURE_NO_TITLE) does not work on API 8, and also <item name="android:windowNoTitle">true</item> does not work, but actionBar.hide() works , the reason that getSupportActionBar() returns null was using one of the two option before, i just forget to remove both. when i remove one i add other(what a a stupid !) thanks all! (sorry for bad English)

like image 682
arsenal Avatar asked Aug 04 '14 12:08

arsenal


Video Answer


1 Answers

Add to your Manifest:

for full screen:

        <activity
        android:name="youtpackagename.activityname"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

or (hide title alone)

       <activity
        android:name="youtpackagename.activityname"
        android:theme="@android:style/Theme.NoTitleBar" >

or else use below code before setContentView method .

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

or

{
  ActionBar actionBar = getActionBar(); or getSupportActionBar();
  actionBar.hide();
}

Edit:

final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);

Its working fine below api 8 also.. i hope this will help you

like image 130
prabhakaran Avatar answered Oct 18 '22 09:10

prabhakaran