Как убрать toolbar android studio
Как убрать Toolbar
Помогите. Создаю первое приложение на андроид и хочу весь экран заполнить одним изображением, а поверх его написать текст и кнопки расставить. Создаю под андроид 5.0. Мне мешает этот белый тулбар, где написано «WaY». Перепробовал все, что умею, не уходит. Как его убрать?
3 ответа 3
Можно сменить тему а ещё можно програмно скрыть:
Но лучше, конечно, через тему
Вообще в res/values/styles.xml, Вы всегда можете создать дополнительно несколько тем на выбор(Dark/Light/.NoActionBar, и т.д.), в которые и будете прописывать свои опции/цвета(обычно используется для большого кол-ва экранов в Вашем приложении).
После чего в активити прописываете наобходимые Вам темы для конкретного экрана:
Всё ещё ищете ответ? Посмотрите другие вопросы с метками java android или задайте свой вопрос.
Похожие
Подписаться на ленту
Для подписки на ленту скопируйте и вставьте эту ссылку в вашу программу для чтения RSS.
дизайн сайта / логотип © 2021 Stack Exchange Inc; материалы пользователей предоставляются на условиях лицензии cc by-sa. rev 2021.12.22.41046
Нажимая «Принять все файлы cookie» вы соглашаетесь, что Stack Exchange может хранить файлы cookie на вашем устройстве и раскрывать информацию в соответствии с нашей Политикой в отношении файлов cookie.
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
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
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 🙂
Change
Below are the steps for hiding the action bar permanently:
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:
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:
No changes to the AndroidManifest file are needed.
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.
How do I remove the title bar from my app?
In my app there is this title bar at the top where the overflow menu would be, but I don’t need settings and only have one screen. When I change the theme like described in many other questions I get the old 2.2 theme. I want to have the modern theme just without the bar at the top.
26 Answers 26
if colors are irrelevant to your app, you can actually go for
Just simply put getSupportActionBar().hide(); between super.onCreate and setContentView method.
you can change name=»———«
find android:theme=»@style/AppTheme» chang to android:theme=»@style/no_title»
click select Theme on menubar (it’s green color near MainActivity)
delete the following from activity_main.xml
do this in you manifest file:
Try changing styles to NoActionBar if that doesn’t works add this code to your main activity
This works for me i hope this work for you as well
In Kotlin, this is how to do.
Best way is to use actionbar function setTitle() if you wish to show logo or have some other stuff in you actionBar but dont want to see name of the app, write this code in MainActivity.java or anywhere you wish to hide title in onCreate :
This way your app won’t have reason to crash.
Just use setTitle(null) above
The title will disappear then you can use the logo of your choice.
The easiest way: Just double click on this button and choose «NoTitleBar» 😉
I have faced the same problem as you, and solve this problem just by changing the class which I extended.
Урок 13. Работа с Toolbar и menu на примере UserInfoActivity
Знакомство с элементом Toolbar
На главном экране приложения с детальной информацией о пользователе нам необходимо создать такой toolbar :
Здесь у нас находится только один элемент: кнопка поиска, которая должна перенаправлять нас на экран для поиска других пользователей.
Поэтому сперва нам необходимо позаботиться о том, чтобы наши экраны не содержали элемент ActionBar по умолчанию. Для этого нам нужно унаследовать главный стиль приложения (находится в файле styles.xml ) от необходимого нам Theme.AppCompat.Light.NoActionBar :
Атрибуты элемента Toolbar
Остановимся на некоторых атрибутах:
Давайте запустим приложение и посмотрим, что получилось:
Запустим приложение, посмотрим, что получилось:
Отлично, двигаемся дальше.
Осталось наполнить наш toolbar содержимым. Т.к. нашему тулбару необходима всего одна кнопка поиска, то мы можем обойтись стандартным способом добавления элементов в тулбар: при помощи Menu (помимо примера ниже также можете ознакомиться с данным уроком).
Скачивание png иконки
Наша задача – обеспечить приложение иконками для разных разрешений. Подробнее об этом можно почитать в официальной документации.
Т.е. мы скопировали несколько иконок для разных размеров экранов.
Создание menu
Нажимаем OK и видим, что папка создалась.
Давайте добавим в метод использование user_info_menu :
Отлично, дело за малым: выполнить необходимое нам действие по клику на кнопку – перейти на экран для поиска пользователей:
Запустим приложение и посмотрим на результат:
В результате данного урока мы узнали: