質問

I can change the Theme for the app i am doing not to have the title bar. Although this updates the layout i am working on under eclipse adt when i run it in the device the title bar is still there. Any suggestions?

役に立ちましたか?

解決 2

If you wanna hide the titlebar in your activity use the following code requestWindowFeature(Window.FEATURE_NO_TITLE); before the setContentView();

他のヒント

You can remove the title bar from any one of 3 different places.

1- In a style definition:

<style name="generalnotitle" parent="general">
    <item name="android:windowNoTitle">true</item>
</style>

2- In a manifest file, at the application level, ...

<application android:theme="@android:style/Theme.NoTitleBar">

...or at the activity level:

// either
android:theme="@android:style/Theme.NoTitleBar"
// or (not both)
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

3- In the Activity's Java file, within the onCreate method, just before the call to setContentView:

requestWindowFeature(Window.FEATURE_NO_TITLE);

JGarrido provides a great answer. Here is an extra information if it still does not work for you:

If your emulator says: "Unfortunately [your appname] has stopped." and you find the error message in Android Studio 1.0 RC4:

java.lang.RuntimeException: Unable to start activity ComponentInfo{xyz.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

Then open MainActivity.java and change

public class MainActivity extends ActionBarActivity {

to

public class MainActivity extends Activity {

I found this tip after struggling for one hour. And hope it can help other developers as well.


PS: And if the links open in a new window afterwards, instead of the same webview window, add this code inside the onCreate, in the end.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top