Android - FEATURE_NO_TITLE not working

I am trying to display my about us page via layout, so I don't need any title bar. I tried:

Dialog d = new Dialog(this);
d.setContentView(R.layout.about_us);
d.setCanceledOnTouchOutside(true);
d.requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
d.show();

but when I click on the menu item, it force closes. when I comment the third line of the code above, it shows my layout with title bar, which I don't need. P.S.: my activity extends ActionBarActivity, is this the reason? If yes then I need an alternative.

Answers


Pass a theme to your dialog can remove the title bar for you.

  1. Add the following code in your res/values/styles.xml:
<style name="NoTitleDialog" parent="@android:Theme.Dialog">
    <item name="android:windowNoTitle">true</item>
</style>
  1. Pass the theme to your dialog:

Dialog d = new Dialog(this, R.style.NoTitleDialog);


Need Your Help

Persisting entities to both database and search engine

java spring java-ee jpa elasticsearch

I am creating an application where I use JPA and ElasticSearch. I have a question on how to structure and hook them together. I have an entity named Newspaper.

Print digits in decreasing fashion and then print factorials for number up to n

java recursion

I want to take an integer n from the user and use it to print n-0, n-1, n-2, and so on down to zero (one number per line) and then back from from 0! to n!. Recursively. But I'm pretty much totally ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.