@LorDDrouS
Учусь создавать android приложения

Как в ToolBar сделать иконки как на скрине?

34abc387fec54692aee393c98806cec6.png

Как сделать так как на картинке?
Вот что я имею на данный момент2a8b721a1d194d5eb97bfc24721ff2db.png
у меня там нету ничего, я пробовал и иконки добавлять, но там ничего не выходит
Вот код активити:
<android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <!-- The ActionBar displayed at the top -->
        <include
            layout="@layout/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <!-- The main content view where fragments are loaded -->
    </LinearLayout>

    <!-- The navigation drawer that comes from the left -->
    <!-- Note that `android:layout_gravity` needs to be set to 'start' -->

    <android.support.design.widget.NavigationView
        android:id="@+id/nvView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@android:color/white"
        app:menu="@menu/list"
        app:headerLayout="@layout/nav_header"
        />

     <LinearLayout
         android:layout_width="1dp"
         android:layout_height="1dp"
         android:paddingBottom="1dp"
         android:paddingTop="1dp">
     <ListView
         android:id="@+id/task_list"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingBottom="5dp"
         android:paddingTop="150dp"
         android:paddingLeft="3dp"
         android:nestedScrollingEnabled="false" />
     </LinearLayout>
     <LinearLayout
        android:layout_width="130dp"
        android:layout_height="50dp"
        android:orientation="horizontal"
         android:baselineAligned="true"
         android:paddingTop="10dp"
         android:gravity="top">

        <EditText
            android:id="@+id/task_input"
            android:layout_width="273dp"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="text"
            android:hint="@string/input_hint"
            android:paddingBottom="5dp"
            android:paddingRight="30dp"
            android:layout_marginTop="65dp"
            android:elegantTextHeight="false"
            android:editable="true">
            <requestFocus />
        </EditText>

        <Button
            android:id="@+id/submit_button"
            android:layout_width="wrap_content"
            android:layout_height="36dp"
            android:onClick="createTask"
            android:text="@string/submit_button"
            android:gravity="right"
            android:padding="8dp"
            android:layout_weight="4"
            android:layout_marginTop="58dp"
            android:minWidth="64dp" />
    </LinearLayout>

</android.support.v4.widget.DrawerLayout>

А это Toolbar:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:fitsSystemWindows="true"
    android:minHeight="?attr/actionBarSize"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:background="?attr/colorPrimaryDark">
</android.support.v7.widget.Toolbar>
  • Вопрос задан
  • 2325 просмотров
Решения вопроса 1
iLLuzor
@iLLuzor
Java, Kotlin, Android Developer
Нужно создать menu.xml с соответствующими иконками пунктов и задать атрибут app:showAsAction="ifRoom". Подробней по ссылке.
Сами иконки можно взять, например, тут.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@LorDDrouS Автор вопроса
Учусь создавать android приложения
у меня есть этот файл, вот он 15a64a6c375443a99b84bcdc8bb414a9.png
а вот в тулбар ничего, я нажимаю на телефоне на настройки и там выходит только title
это вот другое активити тут полегче, здесь нет navigation drawer



eff9f647c66948bbb66f5446f88c1776.png
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы