App bar icons android

Status Bar Icons

In this document

See also

New Guides for App Designers!

Check out the new documents for designers at Android Design, including more guidelines for Iconography.

Status bar icons are used to represent notifications from your application in the status bar.

As described in Providing Density-Specific Icon Sets and Supporting Multiple Screens, you should create separate icons for all generalized screen densities, including low-, medium-, high-, and extra-high-density screens. This ensures that your icons will display properly across the range of devices on which your application can be installed. See Tips for Designers for suggestions on how to work with multiple sets of icons.

Templates for creating icons in Adobe Photoshop are available in the Icon Templates Pack.

Warning:The style and dimensions of status bar icons have changed dramatically in Android 3.0 and 2.3 compared to previous versions. To provide support for all Android versions, developers should:

  1. Place status bar icons for Android 3.0 and later in the drawable-xhdpi-v11 , drawable-hdpi-v11 , drawable-mdpi-v11 , and drawable-ldpi-v11 directories.
  2. Place status bar icons for Android 2.3 in the drawable-xhdpi-v9 , drawable-hdpi-v9 , drawable-mdpi-v9 , and drawable-ldpi-v9 directories.
  3. Place status bar icons for previous versions in drawable-xhdpi , drawable-hdpi , drawable-mdpi , and drawable-ldpi directories.

Android 3.0 and Later

The following guidelines describe how to design status bar icons for Android 3.0 (API Level 11) and later.

Overview of changes

The design for status bar (notification) icons has been revised in Android 3.0. Status bar icons used in Android 3.0 and later are easier to create, and they allow for more flexible presentation in a variety of situations:

  • Status bar icons are composed simply of white pixels on a transparent backdrop, with alpha blending used for smooth edges and internal texture where appropriate.
  • Icons are square icon contents should fill the available space, although a small amount of internal padding can help maintain balance across status bar icons. See Size and format below for details.

These larger and brighter icons, while highly legible, are too intense for use on dark phone status bars. These icons would be too distracting if used directly in the status bar. Therefore:

  • The system automatically resizes and dims these icons in such situations and developers do not need to supply a separate icon for this purpose. See Automatic dimming below for more on this behavior.

Size and format

Status bar icons should be 32-bit PNGs with an alpha channel for transparency. The finished status bar icon dimensions corresponding to a given generalized screen density are shown in the table below.

Note: The system will shrink and dim status bar icons to minimize distractions, allowing users to focus on the foreground activity.

Table 1. Summary of finished icon dimensions for each generalized screen density.

ldpi (120 dpi)
(Low density screen)
mdpi (160 dpi)
(Medium density screen)
hdpi (240 dpi)
(High density screen)
xhdpi (320 dpi)
(Extra-high density screen)
Status Bar Icon Size
(Android 3.0 and Later)
18 x 18 px 24 x 24 px 36 x 36 px 48 x 48 px

You can also include a few pixels of padding in status bar icons to maintain a consistent visual weight with adjacent icons. For example, a 48 x 48 pixel xhdpi status bar icon can contain a 44 x 44 pixel shape with 2 pixels on each side for padding.

Читайте также:  Беспроводные наушники apple работают с android

Style, colors, and effects

Status bar icons are flat, pictured face on, and must be white on a transparent background.

In order to maintain consistency across all status bar notifications, status bar icons should use the styling shown in Figure 1.

Figure 1. Style for status bar icons.

1. Fill color: #ffffff
2. Inner content: Inner content should subtract from the outer shape and consist purely of transparent pixels.

Automatic dimming

The system may dim and shrink status bar icons to allow users to focus on the foreground activity. For example, in Android 4.0, the platform-standard status bar for handset-size devices reduces icons to 18 x 18 dip and 40% opacity in the status bar, while drawing them full-size and at full intensity in the expanded notification panel. An example of what this looks like is shown below in Figure 2.

Figure 2. Automatic shrinking and dimming behavior in Android 3.0 and later.

Example icons

Shown below are example extra-high-density status bar icons that are used throughout Android system applications.

Warning: Because resources can change between platform versions, you should not reference built-in icons using the Android platform resource IDs (i.e. status bar icons under android.R.drawable ). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system’s copy changes. Note that the grid below is not intended to be complete.

Android 2.3

The following guidelines describe how to design status bar icons for Android 2.3 (API Levels 9 and 10).

Size and positioning

Status bar icons should use simple shapes and forms and those must be scaled and positioned inside the final asset.

Figure 3 illustrates various ways of positioning the icon inside the asset. You should size the icons smaller than the actual bounds of the asset. Status bar icons may vary in width, but only minimally.

In order to indicate the recommended size for the icon, each example in Figure 3 includes two different guide rectangles:

  • The red box is the bounding box for the full asset.
  • The blue box is the recommended bounding box for the actual icon. The icon box is sized smaller vertically than the full asset box to allow for varying icon shapes while maintaining a consistent visual weight.

Figure 3. Status bar icon sizing and positioning inside the bounds of the icon asset.

Style, colors, and effects

Status bar icons are flat, matte, and pictured face-on.

  1. Status bar icon dimensions for high-density ( hdpi ) screens:
    1. Full Asset: 24w x 38h px (preferred, width may vary)
    2. Icon: 24w x 24h px (preferred, width may vary)
  1. Status bar icon dimensions for medium-density ( mdpi ) screens:
    1. Full Asset: 16w x 25 px (preferred, width may vary)
    2. Icon: 16w x 16w px (preferred, width may vary)
  1. Status bar icon dimensions for low-density ( ldpi ) screens:
    1. Full Asset: 12w x 19h px (preferred, width may vary)
    2. Icon: 12w x 12h px (preferred, width may vary)

Figure 4. Style and effects for status icons.

Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.

1. Fill gradient: 90°, from #828282 to #919191
2. Inner shadow: #FFFFFF , 10% opacity
angle 90°
distance 1px
size 0px
3. Inner content: Inner content should subtract from the outer shape and consist purely of transparent pixels.

Do’s and don’ts

Below are some «do and don’t» examples to consider when creating status bar icons for your application.

Example icons

Shown below are standard high-density status bar icons that are used in the Android platform.

Warning: Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. status bar icons under android.R.drawable ). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system’s copy changes. Note that the grid below is not intended to be complete.

Android 2.2 and Earlier

The following guidelines describe how to design status bar icons for Android 2.2 (API Level 8) and earlier.

Structure

  • Rounded corners must always be applied to the base shape and to the details of a status bar icon shown Figure 5.
  • All dimensions specified are based on a 25×25 pixel artboard size with a 2 pixel safeframe.
  • Status bar icons can overlap the safeframe to the left and right when necessary, but must not overlap the safeframe at the top and bottom.
  • Final art must be exported as a transparent PNG file.
  • Templates for creating status bar icons using Adobe Photoshop are available in the Icon Templates Pack.

Figure 5. Safeframe and corner-rounding for status bar icons. Icon size is 25×25.

Light, effects, and shadows

Status bar icons are slightly debossed, high in contrast, and pictured face-on to enhance clarity at small sizes.

Figure 6. Light, effects, and shadows for status bar icons.

1. Front part: Use fill gradient from primary color palette
2. Inner bevel: depth 100% | direction down
size 0px | angle 90° |
altitude 30°
highlight white 75% opacity
shadow black 75% opacity
3. Detail: white
4. Disabled detail: grey gradient from palette
+ inner bevel: smooth | depth 1% | direction down | size 0px | angle 117° |
altitude 42° | highlight white 70% | no shadow

Color palette

Only status bar icons related to the phone function use full color; all other status bar icons should remain monochromatic.

Источник

How to Create Custom AppBar/ActionBar/ToolBar in Android Studio | Java

Today in this tutorial, we’re going to see how to create a custom AppBar/ActionBar/ToolBar in android.

I also already created a tutorial on this topic, but here I will demonstrate it with different examples.

Gradle dependency

for circle image view:

Set the styles

now go to your styles.xml file and set the theme to NoAction Bar so that we can create our own toolbar.

Design our AppBar/ActionBar/ToolBar

now go to your main XML file and create a ToolBar and set the width and height, make sure min-height should be actionBar size.

this will give you just a toolbar without any field. Look at the below image.

for the logo, we’re using a circular image view. Already add the dependency. Put it inside the toolbar and do the adjustment.

here we set our title to null, so in the main java file assign our toolbar and do the below change

the result will be:

we can also set the logo by using app:logo=”your logo here” in your toolbar

the result will be:

for the menu, create a menu android resource folder and create a menu resource file ( /res/menu/custom_menu.xml)

import that menu in our main java file by using these code of lines

for adding a title simply add a textView inside the toolbar.

Источник

Реализация BottomAppBar. Часть 3: Поведения для Android

BottomAppBar — это один из новых Android Material компонентов, которые были представлены на Google I/O 2018. Благодаря перемещению Navigation Drawer и меню приложения в нижнюю часть экрана, BottomAppBar радикально меняет внешний вид Android приложений.

В первой и второй частях нашей серии статей про BottomAppBar мы познакомились с BottomAppBar и обсудили его атрибуты. Также мы объяснили, как реализовать Navigation Drawer и меню приложения в рамках BottomAppBar.

Поведение

Согласно Material Design, компоненты приложения не являются статичными. Они могут перемещаться или трансформироваться, т.е. иметь какое-то поведение. Material Design также формирует некие рамки для такого поведения. В этой статье мы обсудим детали реализации рекомендуемого поведения для BottomAppBar, которое представлено на странице гайдлайнов для BottomAppBar.

Макет

Первый гайдлайн описывает макет BottomAppBar. Вот что предлагается:

Для разных по смыслу экранов приложения, можно изменять макет и набор пунктов меню в BottomAppBar. Например, можно отображать больше или меньше пунктов меню в зависимости от того, что лучше всего подходит для конкретного экрана.

Основываясь на этом гайдлайне, на главных экранах рекомендуется использовать макет BottomAppBar, показывающий несколько пунктов в меню и центрированную FAB (Floating Action Button). На второстепенных экранах, переход на которые осуществляется с главных, макет BottomAppBar должен состоять из выровненной по правому краю FAB и нескольких дополнительных пунктов в меню. Переходы между этими двумя экранами должны выполняться надлежащим образом. Gif сверху демонстрирует этот гайдлайн.

Теперь давайте посмотрим, как можно реализовать это поведение. У нас есть два xml-файла в папке res/menu для меню каждого экрана:

Когда происходит переход между экранами, например, по нажатию кнопки TOGGLE SCREEN в нашем случае, макет BottomAppBar, включая меню и FAB, должен измениться. Вот базовый код для такого поведения макета BottomAppBar:

Если вы хотите сделать анимированные переходы, нужен дополнительный код. Вы можете изучить исходный код, прикреплённый в конце этой статьи, в котором найдёте анимацию.

Скроллирование

Скроллирование — важный триггер поведения для таких компонентов, как BottomAppBar. На странице гайдлайнов Material Design рекомендуется следующее поведение для этого случая:

При скроллировании BottomAppBar может появиться или исчезнуть:
— Скроллирование вниз скрывает BottomAppBar. Если на нём была FAB, она отсоединяется от панели и остается на экране.
— Скроллирование вверх показывает BottomAppBar и снова присоединяет его к FAB, если она там была.

Ниже приведена демонстрация поведения BottomAppBar при скроллировании.

Чтобы использовать это поведение, BottomAppBar и FAB должны быть прямыми дочерними элементами CoordinatorLayout. Затем мы включаем hideOnScroll и устанавливаем флаги скроллирования для BottomAppBar:

Этого вполне достаточно для реализации такого поведения BottomAppBar.

Возвышение

У каждого компонента в мире Material Design есть возвышение, аналогичное нашему физическому миру. У BottomAppBar возвышение — 8dp, а само содержимое экрана возвышается на 0dp. FAB в статичном состоянии возвышается на 12dp. Два компонента, которые мы ещё вспомним в этой статье, Navigation Drawer и Snackbar, возвышаются на 16dp и 6dp соответственно.

Как правило, Snackbar — это компонент для уведомления пользователя, выскакивающий из нижней части экрана. Но если на экране есть BottomAppBar или Navigation Drawer, поведение Snackbar должно измениться. В этих случаях Snackbar следует показывать над нижними компонентами. Вот демонстрация и соответствующий код для реализации:

Как мы уже упоминали, Navigation Drawer возвышается на 16dp, что означает — согласно гайдлайну —

Меню, выпадающие из BottomAppBar (например, Navigation Drawer), открываются как модальные окна на уровень выше, чем сам BottomAppBar.

Ниже приведена реализация нашего Navigation Drawer:

Navigation Drawer является модальным окном и поэтому следует приведённому выше правилу реализации.

Детали реализации этого поведения выглядят следующим образом. В папке res/menu должен быть создан xml-файл меню для Navigation View, который будет использован в Navigation Drawer:

Затем должен быть создан файл макета для фрагмента, использующего Navigation Drawer:

Этот файл макета содержит Navigation View и другие компоненты, формирующие макет для Navigation Drawer. Чтобы создать этот макет, нам нужен класс фрагмента, расширяющий BottomSheetDialogFragment:

При клике по значку Navigation Drawer создаётся экземпляр этого фрагмента, который показывается в виде модального окна:

Это статья завершает нашу серию статей про BottomAppBar. Найти исходный код этой статьи вы можете на Github. Комментируйте и задавайте вопросы.

Источник

Читайте также:  Все примеры графических ключей для андроид
Оцените статью