Android template android studio

Using Code Templates

In this document

The SDK tools provide templates for quickly creating Android application projects with the basic structure or for adding components to your existing application modules. The code templates provided by the Android SDK follow the Android design and development guidelines to get you on the right track to creating a beautiful, functional application.

There are several types of Android code templates, which can create anything from an entire application down to specific application components. The main categories of code templates are as follows:

Application Templates

Application templates create basic Android application modules that you can immediately run and test on your Android device. These templates are available when you create a new Android module, though you can also use these templates to add new activities to an existing module.

To use Android application templates:

  1. In Android Studio, select File > New > Module.
  2. Enter the settings for your application, including Application Name, Company Domain, Package name, and minimum SDK, then click Next.
  3. Select an application template to use, then click Next. For example,
    • BlankActivity
    • FullScreenActivity
    • MasterDetailFlow
  4. Enter the settings for your activity, including Activity Name, layout Name, Title, and Menu Resource Name, then click Finish.

Note: The other activity template options also create applications, however these applications require further modification before they can be launched on an Android device.

Blank Activity Template

The BlankActivity template with the Navigation Type: None option creates a simple application that follows the Android Design guidelines. Use this template to create a basic, minimal app as a starting point for your project.

This template includes:

  • Title bar ( ActionBar on Android 3.0 and later)
  • Options menu (action overflow on Android 3.0 and later)
  • Basic layout

The BlankActivity template with the Navigation Type: Tabs or Tabs + Swipe option creates an application with three sections based on the Fragment class and a tabbed user interface.

This template includes:

  • ActionBar for tab controls
  • Fragment objects for section content
  • Optional swipe gesture support based on the swipe view design pattern, which extends FragmentPagerAdapter to manage section fragments

The BlankActivity template with the Navigation Type: Swipe Views + Title Strip option creates an application with three Fragment sections, a compact title strip header (known as Scrollable Tabs in the Android Design guide) and swipe navigation between the sections, based on the swipe view design pattern.

This template includes:

  • PagerTitleStrip for section titles
  • Fragment objects for section content
  • FragmentPagerAdapter to manage section fragments

The BlankActivity template with the Navigation Type: Dropdown option creates an application that extends FragmentActivity , containing three Fragment sections, with an ActionBar using list mode navigation.

This template includes:

  • ActionBar for list mode navigation
  • Fragment objects for section content
Example Description
Читайте также:  Драйвер bluetooth для android

Full Screen Activity Template

This template provides an implementation of an activity which alternates between a primary, full screen view and a view with standard user interface controls, including the notification bar and application title bar. The full screen view is the default and a user can activate the standard view by touching the device screen.

This template includes:

  • SystemUiHider implementation that manages hiding of the system user interface using a version-compatible approach
  • Basic layout
Example Description

Master Detail Flow Template

This template creates an adaptive layout for a set of items and associated details. On a tablet device, the item list and item details are displayed on the same screen. On a smaller device, the list and details are displayed on separate screens.

Note: This template follows the recommendations of the Designing for Multiple Screens Android training.

This template includes:

  • Adaptive layout using alternative resource XML files
  • FragmentActivity , Fragment and ListFragment implementations
Example Description

Activity Templates

Android activity templates provide options to add new activities to your existing application.

To use Android activity templates:

  1. Right click the project folder of the Android application where you want to add an activity.
  2. Select New > Other.
  3. Select Android > Android Activity, then click Next.
  4. Select an activity template, then follow the instructions to add it to your existing application.
    • LoginActivity
    • SettingsActivity
    • BlankActivity
    • FullScreenActivity
    • MasterDetailFlow

These templates create the same type of activity as they do when used as an application template, however the following templates create activities which are specifically intended to be used as part of an existing application.

Login Activity Template

This activity template provides input fields and a sample implementation of an AsyncTask that asks users to login or register with their credentials.

This template includes:

  • Recommended user interface for requesting login information
  • AsyncTask implementation for handing network operations separately from the main user interface thread
  • Progress indicator during network operations
Example Description
Читайте также:  Список российского по для андроид

Settings Activity Template

This template extends the PreferenceActivity class and uses an XML file to create preference settings. This template also demonstrates how to implement several data types for settings.

This template includes:

  • Activity extending PreferenceActivity
  • Preference values defined using XML files added to the res/xml/ directory of your project.
Example Description

Other Templates

Android object templates provide options to add new components to your existing application, including the previously mentioned activities as well as the following additional items:

To use Android object templates:

  1. Right-click the module folder of the Android application where you want to add a code component.
  2. Select New
  3. Select the object type and template, then follow the instructions to add it to your existing application.
    • AIDL
    • Activity
    • Folder
    • Fragment
    • Google
    • Other
    • Service
    • UI Component
    • Wear
    • Widget
    • XML

Источник

7 шаблонов Android для вашего следующего проекта

Russian (Pусский) translation by Yuri Yuriev (you can also view the original English article)

Шаблоны проектов — отличный способ учиться на чужой работе. В этой статье перечислены несколько популярных шаблонов Android, доступных на рынке Envato. Если вы ждёте вдохновения или нуждаетесь в помощи с определённой функцией в создании приложения, ищите ответ в одном из этих шаблонов.

Restaurant Finder

Этот шаблон наполнен возможностями и включает в себя даже backend, готовый к развертыванию на сервере. Приложение позволяет искать рестораны поблизости, читать отзывы, делиться в социальных сетях, а также предоставляет возможность заказать столик по email или текстовому сообщению.

Практически каждое современное мобильное приложение обращается к backend, и это ничем не отличается. Шаблон включает в себя backend для хранения ресторанов и профилей пользователей. Имеется панель аналитики, в которой отображаются показатели ресторанов и пользователей приложения. Если вам нужно вдохновение для приложения на основе местоположения, этот шаблон стоит проверить.

Your Radio App

Если вы хотели узнать, как передавать аудио в приложении для Android, этот шаблон достоин внимания. Приложение ориентировано на потоковое аудио с онлайн-радиостанций. Шаблон включает в себя приложение Android с функциями, а также backend для управления радиостанциями, которые пользователи могут прослушивать.

Шаблон совместим как с Android Studio, так и с Eclipse, и опирается на Parse для push-уведомлений. Он также включает AdMob для управления объявлениями. Приложение поддерживает широкий диапазон форматов потоков и имеет красивый, современный интерфейс. Если вы ещё не уверены, download the application из Google Play, чтобы попробовать.

Educational App for Preschoolers

Мобильные телефоны и планшеты — большая радость для детей. Эти устройства дети интуитивно понимают, когда получают в руки. Этот шаблон приложения для самых маленьких, обучает алфавиту и цифрам через звуки и картинки.

Читайте также:  Как обновить стиль андроид

Шаблон включает несколько игр, которые вы можете выбрать и учиться. Шаблон совместим с Eclipse и легко настраивается по вашим потребностям.

Maintenance Service App

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

Пользовательский интерфейс чист и современен. Приложение совместимо с Android Marshmallow и поддерживает старые версии Android. Если вы хотите посмотреть, как выглядит приложение, посмотрите this video the author put on YouTube.

Taxi Booking App

Я уже упоминал, что многие традиционные компании переходят на mobile и это касается таксомоторных компаний. Вот почему Uber и Lyft так популярны. Этот шаблон для Android впечатляет. Он содержит многофункциональное приложение для Android, а также мощный backend, полное решение. Приложение имеет интерактивную карту с информацией о транспортном средстве и отслеживанием, распознавание голоса и поддержку push-уведомлений.

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

Inventory Management App

Составление описи отнимает или время с ручкой и бумагой, или деньги из-за дорогого оборудования и инфраструктуры. Теперь это не так, и шаблон Android показывает, каковы возможности. Добавлять, обновлять и просматривать продукты легко и просто и пользователь уведомляется, если инвентаризация заканчивается.

Шаблон легкий, но удивительно мощный. Продукты хранятся локально в базе данных SQLite и есть поддержка экспорта в электронную таблицу. Вы можете загрузить приложение с веб-сайта автора, если хотите его просмотреть.

Pixel Art

Кто не любит pixel art? Я думаю, любит каждый разработчик. Этот шаблон представляет собой простое приложение для рисования в стиле pixel art. Инструменты просты, но мне очень нравятся результаты, которые с ними можно получить.

Автор включил короткое видео, в котором он создает Luigi, брата Mario. Если вы хотите больше узнать о рисовании на Android, тогда это отличный шаблон для начала.

Envato Market содержит десятки шаблонов мобильных приложений для создания вашего следующего проекта. Эти шаблоны хороши для обучения или изучения того, как коллеги-разработчики реализовали определённую функцию. Они великолепны, если вы ищете вдохновения. Проверяйте Android templates on Envato Market.

Источник

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