Android studio как убрать appbar

Как удалить строку заголовка в студии Android?

В моем приложении эта строка заголовка находится вверху, там, где должно быть дополнительное меню, но мне не нужны настройки, и у меня только один экран. Когда я меняю тему, как описано во многих других вопросах, я получаю старую тему 2.2. Я хочу иметь современную тему только без панели наверху.

Перейдите в styles.xml и измените его .DarkActionBar на .NoActionBar

если цвета не имеют отношения к вашему приложению, вы можете выбрать

В файле манифеста Изменить:

работает onCreate() при setContentView() вызове перед .

иначе он выйдет из строя

В файле styles.xml измените DarkActionBar на NoActionBar

Это работает для меня

В файле манифеста измените на это:

Это работало для меня при values/styles.xml добавлении элементов:

Перейдите в Project -> app -> main -> res -> values ​​-> styles.xml

Измените эту строку, если хотите удалить ее для каждого просмотра

если вы хотите сделать это только для одного представления, вы можете изменить его в своих данных манифеста. Заходим в Android -> манифесты -> AndroidManifest.xml. сделать следующее:

  1. Найдите представление, в котором вы хотите получить изменения этого типа
  2. Добавить android:theme=»»@style/Theme.AppCompat.NoActionBar»

вы можете изменить name = «———«

найти android: theme = «@ style / AppTheme» измененный на android: theme = «@ style / no_title»

нажмите выбрать тему в строке меню (зеленый цвет рядом с MainActivity)

  • нажмите тема проекта
  • щелкните no_title (справа от вас)
  • нажмите ОК

Источник

Как убрать Toolbar

Помогите. Создаю первое приложение на андроид и хочу весь экран заполнить одним изображением, а поверх его написать текст и кнопки расставить. Создаю под андроид 5.0. Мне мешает этот белый тулбар, где написано «WaY». Перепробовал все, что умею, не уходит. Как его убрать?

3 ответа 3

в res/values/styles.xml измените тему, от которой наследуется ваша тема, на подходящую вам с окончанием .NoActionBar

Можно сменить тему а ещё можно програмно скрыть:

Но лучше, конечно, через тему

Вообще в res/values/styles.xml, Вы всегда можете создать дополнительно несколько тем на выбор(Dark/Light/.NoActionBar, и т.д.), в которые и будете прописывать свои опции/цвета(обычно используется для большого кол-ва экранов в Вашем приложении).

После чего в активити прописываете наобходимые Вам темы для конкретного экрана:

Всё ещё ищете ответ? Посмотрите другие вопросы с метками java android или задайте свой вопрос.

Похожие

Подписаться на ленту

Для подписки на ленту скопируйте и вставьте эту ссылку в вашу программу для чтения RSS.

Читайте также:  Doc view для android

дизайн сайта / логотип © 2021 Stack Exchange Inc; материалы пользователей предоставляются на условиях лицензии cc by-sa. rev 2021.12.3.40888

Нажимая «Принять все файлы cookie» вы соглашаетесь, что Stack Exchange может хранить файлы cookie на вашем устройстве и раскрывать информацию в соответствии с нашей Политикой в отношении файлов cookie.

Источник

Android Studio — Action Bar remove

I’m trying to remove/disable the ActionBar. I tried to put in the Manifest:

and it doesn’t work. It doesn’t remove the ActionBar. Please help me. Thanks.

9 Answers 9

I had this issue too. I went to styles.xml and changed

and that removed it from all my activities.

in your oncreate() method use this

If your minSdkVersion is 10 or lower, instead use:

You can try this. It works for me

Add it in style.xml

and use the style at manifest.xml.

For android studio You can go to styles.xml and change

and in Eclipse it can be changed in manifest file

I think this should work.

You hide action bar by with different ways.

1.action bar hidden through the manifest xml file (non Java Programming), then the easy way is to add the following attribute in Activity tag:

If custom Theme is created then it is convenient to create another style extending the custom theme.

Источник

Remove Android App Title Bar

I understand that these properties in the manifest:

can remove the title bar. However, I constantly check the Graphical Layout when I am modifying my app. When I look at the Graphical Layout I still see the title bar. I want to remove the title bar in a way that I don’t have to see it during the development of the game.

17 Answers 17

Simple way is to put this in your onCreate() :

In the Design Tab, click on the AppTheme Button

Choose the option «AppCompat.Light.NoActionBar»

Place this after

This worked for me.try this

I was able to do this for Android 2.1 devices and above using an App Compatibility library theme applied to the app element in the manifest:

Note: You will need to include the com.android.support:appcompat-v7 library in your build.gradle file

There are two options I’d like to present:

  1. Change the visibility of the SupportActionBar in JAVA code
  2. Choose another Style in your project’s style.xml
Читайте также:  Как изменить координаты x y экрана андроид

1: Add getSupportActionBar().hide(); to your onCreate method.

2: Another option is to change the style of your Application. Check out the styles.xml in «app->res->values» and change

If you use AppCompat v7, v21

Use this to remove title from android app in your Androidmainfest.xml

or you can use this in your activity

If you have import android.support.v7.app.ActionBarActivity; and your class extends ActionBarActivity then use this in your OnCreate :

In the graphical editor, make sure you have chosen your theme at the top.

It’s obvious, but the App Theme selection in design is just for display a draft during layout edition, is not related to real app looking in cell phone.

Just change the manifest file ( AndroidManifest.xml ) is not enough because the style need to be predefined is styles.xml . Also is useless change the layout files.

All proposed solution in Java or Kotlin has failed for me. Some of them crash the app. And if one never (like me) uses the title bar in app, the static solution is cleaner.

For me the only solution that works in 2019 (Android Studio 3.4.1) is:

Источник

How to disable action bar permanently

I can hide the action bar in honeycomb using this code:

But when the keyboard opens, and user copy-pastes anything, the action bar shows again. How can I disable the action bar permanently?

28 Answers 28

If you are using Theme.Holo.Light and want to use the Theme.Holo.Light.NoActionBar variant on pre 3.2 devices you can add this to your styles.xml :

and then set it as your activity’s theme:

By setting activity theme in Manifest,

I use the following code inside my onCreate function:

maybe this help you

With the Android Studio default generated Activity superclass is ActionBarActivity and then, none of solution in other responses works. To solve just change superclass:

If you want to get full screen without actionBar and Title.

Add it in style.xml

and use the style at manifest.xml.

Go to styles.xml Change this DarkActionBar to NoActionBar

The best way I found which gives custom themes and no action bar, is to create a SuperClass for all activities in my project and in it’s onCreate() call the following line of code —

It always work for me. The only issue in this approach is, you’ll see action bar for a fraction of second when starting the app (Not the activity, the complete app).

You can force hide the action bar simply:

Читайте также:  Супер марио ран для андроид

Just use your default theme, it will work good if fullscreen is set

Don’t use Holo theme and the Actionbar will disappear. This code is working for me on API 8+, with support lib v7:

set that theme for your activity:

and in your activity class.

It works even when it extends ActionBarActivity.

If you just want a theme with no action bar you can use ‘NoActionBar’ variant, for eg. if your base theme is as below

then you can use

But if you want to retain the properties of your main theme i.e. AppTheme you can do as below

You can retain all the properties of your base theme this way and don’t have to explicitly add them in your NoActionBar theme 🙂

Under res -> values ->styles.xml

Change

Below are the steps for hiding the action bar permanently:

  1. Open app/res/values/styles.xml.
  2. Look for the style element that is named «apptheme». Should look similar to

Step 2: In your AndroidManifest.xml, add this theme to the activity you want in: e.g. I want my main activity without action-bar so add this like below:

This is the best solution for me after trying a lot of things.

in the onCreate function add the following code

and just import android.support.v7.app.ActionBar

Make sure you create a new theme by changing the name of the default theme in the styles.xml file to:

This is the way most of the Dialer applications in android is showing the ViewPager without the action bar.

try this in your manifist

There are two ways to disable ActionBar in Android.

I use this solution:

in the manifest, inside your activity tag:

and in strings.xml:

This way you keep ActionBar (or Toolbar) with the title, but when Activity if created the title is automatically empty.

Strangely enough, none of these worked for me when building on a Nexus 7 running 4.4.2 (API 19). For the most part, at least with the latest version of Android Studio (1.2.1.1) after creating a blank activity app, the:

is in the application element, not the activity element. If I removed the above code or tried to change it to:

the app won’t run. if this is happening to you, just go into your styles.xml file (res > values > styles.xml) and add the .NoTitleBar to the end of the parent like this block:

No changes to the AndroidManifest file are needed.

Источник

Оцените статью