2

I have an activity in my app, which is using swipeable tabs with action bar

For example :-

this tutorial

So my question is to add action bar to my activity and remove titlbar

similar question

Community
  • 1
  • 1
Nishant Tanwar
  • 383
  • 4
  • 8
  • 18

3 Answers3

1

Add this to your activity before calling setContentView();

this.requestWindowFeature(Window.FEATURE_ACTION_BAR | Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
             WindowManager.LayoutParams.FLAG_FULLSCREEN);

if that dosen't work try this

//use this to disable the icon from ActionBar
    getActionBar().setDisplayShowHomeEnabled(false);

    //use this to disable the application name from ActionBar
    getActionBar().setDisplayShowTitleEnabled(false);
danidee
  • 9,298
  • 2
  • 35
  • 55
1

I'm unsure as to exactly what you class as a title bar but you could do this in XML by putting the following in your Android Manifest for a particular activity to remove your title bar.

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen
Optimistic
  • 27
  • 1
  • 7
0

Use this code in oncreate() method of activity before adding content:

 getWindow().requestFeature(Window.FEATURE_NO_TITLE)
Sanjay Kushwaha
  • 70
  • 2
  • 10