In my activity that extends the FragmentActivity class, I can't disable the title using this.requestWindowFeature(Window.FEATURE_NO_TITLE);
. It gives an ANR.
How can I disable a FragmentActivity's title?
This is the partial code of the activity's start:
public class NewOrderActivity extends FragmentActivity implements TabListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
...
}
}
EDIT: ANSWER:
Okay, I found out that in an activity that has an ActionBar declared in it, the title is a part of the Action Bar not the windows itself.
so in my code I did this to get rid of the window's ( or better to say, ActionBar's ) title:
...
...
final ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(Window.FEATURE_NO_TITLE);
...
...
you should use:-
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
Try applying *.NoActionBar
theme to activity in your AndroidManifest.xml
<activity
android:name=".NewOrderActivity"
android:theme="@android:style/Theme.Holo.NoActionBar">
<!-- ... -->
</activity>
This trick solves your problem :)
ActionBar bar = getActionBar();
bar.hide();
or
ActionBar bar = getActionBar();
bar.setDisplayShowHomeEnabled(false);
bar.setDisplayShowTitleEnabled(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With