Material design github android

Material design github android

Copy raw contents

Getting started with Material Components for Android

1. Migration guidance

Take a look at our guide and codelab to help you migrate your codebase using Material Components for Android to the new Material 3 system.

Additionally, if you are still using the legacy Design Support Library, take a look at our legacy guide to help you migrate your codebase to Material Components for Android.

2. Maven library dependency

Material Components for Android is available through Google’s Maven Repository. To use it:

Open the build.gradle file for your application.

Make sure that the repositories section includes Google’s Maven Repository google() . For example:

Add the library to the dependencies section:

Visit Google’s Maven Repository or MVN Repository to find the latest version of the library.

Note: In order to use the new Material3 themes and component styles, you must depend on version 1.5.0-alpha04 or later.

New Namespace and AndroidX

If your app currently depends on the original Design Support Library, you can make use of the Refactor to AndroidX… option provided by Android Studio. Doing so will update your app’s dependencies and code to use the newly packaged androidx and com.google.android.material libraries.

If you don’t want to switch over to the new androidx and com.google.android.material packages yet, you can use Material Components via the com.android.support:design:28.0.0 dependency.

Note: You should not use the com.android.support and com.google.android.material dependencies in your app at the same time.

3. Android 12 compilation

In order to use the latest versions of Material Components for Android and the AndroidX Jetpack libraries, you will have to install the latest version of Android Studio and update your app’s compileSdkVersion to 31 .

As part of migrating to Android 12, you’ll need to add android:exported to any activities, services, or broadcast receivers in your manifest that use intent filters (see the documentation). Consider reading through the Android 12 app migration guide and behavior changes for more tips and information.

4. Java 8 compilation

The latest AndroidX Jetpack libraries now require your app to be compiled with Java 8. See the Java 8 language features and APIs documentation for more information on Java 8 support and how to enable it for your app.

Use AppCompatActivity to ensure that all the components work correctly. If you are unable to extend from AppCompatActivity , update your activities to use AppCompatDelegate . This will enable the AppCompat or Material versions of components to be inflated (depending on your theme), among other important things.

Читайте также:  Android как увеличить изображение

6. Material3 theme inheritance

We recommend you perform an app-wide migration by changing your app theme to inherit from a Material3 theme. Be sure to test thoroughly afterwards, since this may change the appearance and behavior of existing layout components.

Check out the new Material Theme Builder which can be used to generate your Material3 app theme, with all of the Material Color System roles filled out based on your brand colors.

Note: If you can’t change your theme, you can continue to inherit from an AppCompat or MaterialComponents theme and add some new theme attributes to your theme. See the AppCompat or MaterialComponents themes section for more details.

Material3 themes

Here are the Material3 themes you can use to get the latest component styles and theme-level attributes, as well as their MaterialComponents equivalents when applicable.

Material3 MaterialComponents
Theme.Material3.Light Theme.MaterialComponents.Light
Theme.Material3.Light.NoActionBar Theme.MaterialComponents.Light.NoActionBar
Theme.Material3.Dark Theme.MaterialComponents
Theme.Material3.Dark.NoActionBar Theme.MaterialComponents.NoActionBar
Theme.Material3.DayNight Theme.MaterialComponents.DayNight
Theme.Material3.DayNight.NoActionBar Theme.MaterialComponents.DayNight.NoActionBar
N/A Theme.MaterialComponents.Light.DarkActionBar
N/A Theme.MaterialComponents.DayNight.DarkActionBar

Update your app theme to inherit from one of these themes:

For more information on how to set up theme-level attributes for your app, take a look at our Theming guide, as well as our Dark Theme guide for why it’s important to inherit from the DayNight theme.

Material3 themes enable a custom view inflater, which replaces default components with their Material counterparts. Currently, this replaces the following XML components:

AppCompat or MaterialComponents Themes

You can incrementally test new Material components without changing your app theme. This allows you to keep your existing layouts looking and behaving the same, while introducing new components to your layout one at a time.

However, you must add the following new theme attributes to your existing app theme, or you will encounter ThemeEnforcement errors:

7. Add Material components

Take a look at our documentation for the full list of available Material components. Each component’s page has specific instructions on how to implement it in your app.

Let’s use text fields as an example.

Implementing a text field via XML

The default outlined text field XML is defined as:

Note: If you are not using a theme that inherits from a Material3 theme, you will have to specify the text field style as well, via style=»@style/Widget.Material3.TextInputLayout.OutlinedBox»

Other text field styles are also provided. For example, if you want a filled text field in your layout, you can apply the Material3 filled style to the text field in XML:

Material Components for Android welcomes contributions from the community. Check out our contributing guidelines as well as an overview of the directory structure before getting started.

Источник

Material Components

Pinned Loading

Modular and customizable Material Design UI components for Android

[In maintenance mode] Modular and customizable Material Design UI components for iOS

Modular and customizable Material Design UI components for the web

Modular and customizable Material Design UI components for Flutter

Documentation and policies for Material Components (all platforms)

Modular and customizable Material Design UI components for the web

69 Updated Dec 4, 2021

Material Design Web Components

37 Updated Dec 3, 2021

Companion example apps and code for MDC-Android.

6 Updated Dec 3, 2021

A library that enables reuse of Material themes defined in XML for theming in Jetpack Compose.

0 Updated Dec 2, 2021

Material Design plugin for WordPress

4 Updated Dec 2, 2021

Modular and customizable Material Design UI components for Android

39 Updated Dec 2, 2021

[In maintenance mode] Modular and customizable Material Design UI components for iOS

12 Updated Dec 1, 2021

Adaptive packages for Flutter

4 Updated Nov 21, 2021

Work in progress code, implementation options, and design prototypes. Organized by branch.

0 Updated Nov 18, 2021

Codelabs for Material Components for Flutter

1 Updated Nov 15, 2021

People

Top languages

Most used topics

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Material design github android

Material Design Android Library

If you want use this library, you only have to download MaterialDesign project, import it into your workspace and add the project as a library in your android project settings.

If you prefer it, you can use the gradle dependency, you have to add these lines in your build.gradle file:

Some components have custom attributes, if you want use them, you must add this line in your xml file in the first component:

If you are going to use a ScrollView, it is recommended that you use the CustomScrollView provided in this library to avoid problems with the custom components. To use this component:

It is recommended to put this component in the right-bottom of the screen. To use this component write this code in your xml file. If you don`t want to start this component with animation set the animate attribute to false. Put your icon in the icon attribute to set the drawable icon for this component.

######Float small button

######CheckBox

######Progress bar circular indeterminate

######Progress bar indeterminate

######Progress bar indeterminate determinate

If you begin progrees, you only have to set progress it

######Progress bar determinate

You can custom max and min progress values with materialdesign:max=»50″ and materialdesign:min=»25″ attributes.

######Slider with number indicator

If you don’t want to show the button, put null in buttonText attribute

You can set the accept and cancel button on the event listener or change it’s text

Источник

Material Design for Android

Developer Docs

Creating Apps with Material Design

Video

Introduction to Material Design

Video

Paper and Ink: The Materials that Matter

Video

Material Design in the Google I/O App

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. Android now includes support for material design apps. To use material design in your Android apps, follow the guidelines defined in the material design specification and use the new components and functionality available in Android 5.0 (API level 21) and above.

Android provides the following elements for you to build material design apps:

  • A new theme
  • New widgets for complex views
  • New APIs for custom shadows and animations

For more information about implementing material design on Android, see Creating Apps with Material Design.

Material Theme

The material theme provides a new style for your app, system widgets that let you set their color palette, and default animations for touch feedback and activity transitions.

Dark material theme

Light material theme

Lists and Cards

Android provides two new widgets for displaying cards and lists with material design styles and animations:

The new RecyclerView widget is a more pluggable version of ListView that supports different layout types and provides performance improvements.

The new CardView widget lets you display important pieces of information inside cards that have a consistent look and feel.

View Shadows

In addition to the X and Y properties, views in Android now have a Z property. This new property represents the elevation of a view, which determines:

  • The size of the shadow: views with higher Z values cast bigger shadows.
  • The drawing order: views with higher Z values appear on top of other views.

Animations

The new animation APIs let you create custom animations for touch feedback in UI controls, changes in view state, and activity transitions.

These APIs let you:

  • Respond to touch events in your views with touch feedback animations.
  • Hide and show views with circular reveal animations.
  • Switch between activities with custom activity transition animations.
  • Create more natural animations with curved motion.
  • Animate changes in one or more view properties with view state change animations.
  • Show animations in state list drawables between view state changes.

Touch feedback animations are built into several standard views, such as buttons. The new APIs let you customize these animations and add them to your custom views.

Drawables

These new capabilities for drawables help you implement material design apps:

  • Vector drawables are scalable without losing definition and are perfect for single-color in-app icons.
  • Drawable tinting lets you define bitmaps as an alpha mask and tint them with a color at runtime.
  • Color extraction lets you automatically extract prominent colors from a bitmap image.

Источник

Читайте также:  Android планшет tegra 3
Оцените статью