Jacob is studying on programming 프로그래밍 관련정보를 모아둔 jacob yoo 의 개인 블로그입니다
  • Home
  • programming
  • About me
  • contact me

Daily Archives: May 22, 2017

You are browsing the site archives by date.
22May 2017

by jacob ⋅ Link

original source : https://guides.codepath.com/android/Design-Support-Library#setup

Overview

At their I/O 2015 conference, Google announced a new design support library, which helps bring a lot of material design components including a navigation drawer view, floating labels, floating action buttons, snackbars, and a new framework to tie motion and scroll events. The library is supported for Android version 2.3 and higher.

Features

The support design library has the following key features:

  1. FloatingActionButton – A round button at the bottom right denoting a primary action on your interface. Promoting key actions within a modern material design app.
  2. TabLayout – An easier way to put tabs around a ViewPager which acts as sliding tabs between fragments within an app.
  3. NavigationView – An easier way to provide a modern navigation drawer from the left with a header and a series of navigation items.
  4. SnackBar – Shown on the bottom of the screen and contains text with an optional single action. They automatically time out after the given time length by animating off the screen.
  5. TextInputLayout – Float the hint above any text field as the user is entering information and/or add a character counter.
  6. CoordinatorLayout – Provides an additional level of control over scroll and touch events between child views.
  7. PercentRelativeLayout and PercentFrameLayout to enable views to occupy percentage-based dimensions.
  8. Vector Drawables to reduce the need to include images for every density size.
  9. Animating view hierarchies using the Transitions framework down to Android 4.0 (API 14) . Currently, there is no backported support for activity/fragment transitions used in this API.
  10. Bottom Navigation Views for easily switching from 3 to 5 tabbed items.
  • AppBarLayout allows your toolbar and other views to react to scroll events.
  • CollapsingToolbarLayout extend this to allow the toolbar to collapse as the user scrolls through a view.
  • Bottom Sheets to expose a sheet of material that slides up from the bottom of the screen.
  • Vector drawables are compatible back to Android 2.1 (API 7), but animated vector drawables are only back-ported to Android 3.0 (API 11).

Setup

Make sure that you have at least the Android Gradle plugin v2.1.0 supported.

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.2'
}

There is a new support design library that must be included. This library also depends on updated versions of the AppCompat library to be included. If you are not currently using this library, check out this migration guide. In addition, make sure these versions have been updated.

Update your root build.gradle file:

android {
   compileSdkVersion 25  // usually needs to be consistent with major support libs used, but not necessary
}

ext {
  supportLibVersion = '25.2.0'  // variable that can be referenced to keep support libs consistent
}

Add these dependencies to your app/build.gradle file:

dependencies {
    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile "com.android.support:design:${supportLibVersion}"
}

If you are using the RecyclerView, CardView, or any other support v7 related libraries you should also upgrade the versions. The RecyclerView for instance has features that are used with this new design support library.

dependencies {
    compile "com.android.support:recyclerview-v7:${supportLibVersion}"
}

Adding Percent Support Library

To add the percent support library, you need to add this statement:

dependencies {
    compile "com.android.support:percent:${supportLibVersion}"
}

Adding Vector Drawable Library

Android Studio v1.4 provides backwards support for vector drawables to pre-Lollipop devices by creating the PNG assets automatically at compile time. The support library eliminates this necessity by providing vector drawable support for older Android versions, but we need to first disable this auto-generation tool by adding these lines to our app/build.gradleconfiguration:


// This config only works for Android Gradle Plugin v2.1.0 or higher:
android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 }  

Finally, the libraries need to be added:

dependencies {
    compile "com.android.support:support-vector-drawable:${supportLibVersion}" // VectorDrawableCompat 
    compile "com.android.support:animated-vector-drawable:${supportLibVersion}" // AnimatedVectorDrawableCompat
}

Check out the vector drawables guide for usage details.

Adding Transitions Library

The Transitions API was first introduced in Android 4.4 (KitKat) but now includes back ported support for animating view hierarchies down to Android 4.0. However, there is no support for activity/fragment transitions currently. To use this library, you need to add the library explicitly:

dependencies {
    compile "com.android.support:transition:${supportLibVersion}"
}

Adding Annotations Library

To leverage the annotations library, you can also explicitly add it to your Gradle file. Adding the AppCompat or support design library implicitly adds it:

dependencies {
    compile "com.android.support:support-annotations:${supportLibVersion}"
}

Installing the Library

You normally need to open the SDK Manager and make sure to download the Android Support Repository as well as the latest Android Support Library. However, Android Studio will also show at the bottom any missing libraries and you can click on the Install repository and sync project. The process will only succeed if you specify a valid library and version, but it enables you to upgrade without needing to open the SDK Manager.

If you are using any type of continuous build system and need to help automate downloading of updates to the support library, you can use Jake Wharton’s SDK Manager to download the packages for you.

Sample Code

If you want to see how to use the various components, check out this sample code. For an example of the percent support library, see this sample code.

Official Source Code

The Android Open Source Project (AOSP) hosts the major release versions for this library, which can be found here. For instance, if you are curious about what styles can be overridden for the different components, see this link.

The latest source code updates for the support library are now always included since v23.1.0 in your SDK directory (i.e. Library/Android/sdk/extras/android/m2repository/com/android/support/design for Mac OS X).

Change Log

Changes in Support Library v23

  • Resources.getColor() has been deprecated. You must now use ContextCompat.getColor() instead. See this Stack Overflow article or the official API documentation.

Changes in Support Library v23.1

TextInputLayout and EditText now includes the ability to add a character counter. (view guide)

A snap flag can also be added to the list of scrolling effects declared in AppBarLayout. (view guide)

A setOnDragListener() method has been added to AppBarLayout. (view guide)

An aspectRatio attribute is now supported in PercentRelativeLayout. (view guide)

A new item animation interface for the RecyclerView. (view guide)

Custom views can be provided for NavigationView rows. (view guide)

Changes in Support Library v23.1.1

  • NavigationView now contains a getHeaderView() method (view guide)

Changes in Support Library v23.2

  • Added support for bottom sheets. (view guide)
  • Added setup instructions for vector drawables. (view guide)

Changes in Support Library v24.2.0

TextInputLayout and EditText now includes the ability to add password visibility toggles. (view guide)

Added DiffUtil class for RecyclerView. (view guide)

Support v4 library modules have been broken apart but cannot be used to reduce APK size because the fragment library still depends on all other related modules. (view guide)

Transitions API backported to Android 4.0 but does not include support for activity/fragment transitions. (view guide)

Changes in Support Library v25.0.0

  • Bottom Navigation Views support added (view guide)

References

  • https://medium.com/android-bites/first-steps-with-the-design-support-library-8dcf06230ddd
  • http://android-developers.blogspot.com/2015/05/android-design-support-library.html
  • https://github.com/chrisbanes/cheesesquare
  • http://hmkcode.com/material-design-app-android-design-support-library-appcompat/
  • https://medium.com/ribot-labs/exploring-the-new-android-design-support-library-b7cda56d2c32
  • https://plus.google.com/+AndroidDevelopers/posts/XTtNCPviwpj
  • https://code.google.com/p/android/issues/list?can=1&q=label%3AVersion-22.2.1
  • https://plus.google.com/+AndroidDevelopers/posts/RZutBRWN6sH?linkId=17978076
  • https://medium.com/@chrisbanes/appcompat-v23-2-age-of-the-vectors-91cbafa87c88#.dvbsz7sts
  • https://plus.google.com/+AndroidDevelopers/posts/iTDmFiGrVne
  • https://www.reddit.com/r/androiddev/comments/4y70e7/android_support_library_v242_released/

Share this:

  • Click to print (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Google+ (Opens in new window)
22May 2017

by jacob ⋅ Link

original source : https://guides.codepath.com/android/Design-Support-Library#setup

Overview

At their I/O 2015 conference, Google announced a new design support library, which helps bring a lot of material design components including a navigation drawer view, floating labels, floating action buttons, snackbars, and a new framework to tie motion and scroll events. The library is supported for Android version 2.3 and higher.

Features

The support design library has the following key features:

  1. FloatingActionButton – A round button at the bottom right denoting a primary action on your interface. Promoting key actions within a modern material design app.
  2. TabLayout – An easier way to put tabs around a ViewPager which acts as sliding tabs between fragments within an app.
  3. NavigationView – An easier way to provide a modern navigation drawer from the left with a header and a series of navigation items.
  4. SnackBar – Shown on the bottom of the screen and contains text with an optional single action. They automatically time out after the given time length by animating off the screen.
  5. TextInputLayout – Float the hint above any text field as the user is entering information and/or add a character counter.
  6. CoordinatorLayout – Provides an additional level of control over scroll and touch events between child views.
  7. PercentRelativeLayout and PercentFrameLayout to enable views to occupy percentage-based dimensions.
  8. Vector Drawables to reduce the need to include images for every density size.
  9. Animating view hierarchies using the Transitions framework down to Android 4.0 (API 14) . Currently, there is no backported support for activity/fragment transitions used in this API.
  10. Bottom Navigation Views for easily switching from 3 to 5 tabbed items.
  • AppBarLayout allows your toolbar and other views to react to scroll events.
  • CollapsingToolbarLayout extend this to allow the toolbar to collapse as the user scrolls through a view.
  • Bottom Sheets to expose a sheet of material that slides up from the bottom of the screen.
  • Vector drawables are compatible back to Android 2.1 (API 7), but animated vector drawables are only back-ported to Android 3.0 (API 11).

Setup

Make sure that you have at least the Android Gradle plugin v2.1.0 supported.

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.2'
}

There is a new support design library that must be included. This library also depends on updated versions of the AppCompat library to be included. If you are not currently using this library, check out this migration guide. In addition, make sure these versions have been updated.

Update your root build.gradle file:

android {
   compileSdkVersion 25  // usually needs to be consistent with major support libs used, but not necessary
}

ext {
  supportLibVersion = '25.2.0'  // variable that can be referenced to keep support libs consistent
}

Add these dependencies to your app/build.gradle file:

dependencies {
    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile "com.android.support:design:${supportLibVersion}"
}

If you are using the RecyclerView, CardView, or any other support v7 related libraries you should also upgrade the versions. The RecyclerView for instance has features that are used with this new design support library.

dependencies {
    compile "com.android.support:recyclerview-v7:${supportLibVersion}"
}

Adding Percent Support Library

To add the percent support library, you need to add this statement:

dependencies {
    compile "com.android.support:percent:${supportLibVersion}"
}

Adding Vector Drawable Library

Android Studio v1.4 provides backwards support for vector drawables to pre-Lollipop devices by creating the PNG assets automatically at compile time. The support library eliminates this necessity by providing vector drawable support for older Android versions, but we need to first disable this auto-generation tool by adding these lines to our app/build.gradleconfiguration:


// This config only works for Android Gradle Plugin v2.1.0 or higher:
android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 }  

Finally, the libraries need to be added:

dependencies {
    compile "com.android.support:support-vector-drawable:${supportLibVersion}" // VectorDrawableCompat 
    compile "com.android.support:animated-vector-drawable:${supportLibVersion}" // AnimatedVectorDrawableCompat
}

Check out the vector drawables guide for usage details.

Adding Transitions Library

The Transitions API was first introduced in Android 4.4 (KitKat) but now includes back ported support for animating view hierarchies down to Android 4.0. However, there is no support for activity/fragment transitions currently. To use this library, you need to add the library explicitly:

dependencies {
    compile "com.android.support:transition:${supportLibVersion}"
}

Adding Annotations Library

To leverage the annotations library, you can also explicitly add it to your Gradle file. Adding the AppCompat or support design library implicitly adds it:

dependencies {
    compile "com.android.support:support-annotations:${supportLibVersion}"
}

Installing the Library

You normally need to open the SDK Manager and make sure to download the Android Support Repository as well as the latest Android Support Library. However, Android Studio will also show at the bottom any missing libraries and you can click on the Install repository and sync project. The process will only succeed if you specify a valid library and version, but it enables you to upgrade without needing to open the SDK Manager.

If you are using any type of continuous build system and need to help automate downloading of updates to the support library, you can use Jake Wharton’s SDK Manager to download the packages for you.

Sample Code

If you want to see how to use the various components, check out this sample code. For an example of the percent support library, see this sample code.

Official Source Code

The Android Open Source Project (AOSP) hosts the major release versions for this library, which can be found here. For instance, if you are curious about what styles can be overridden for the different components, see this link.

The latest source code updates for the support library are now always included since v23.1.0 in your SDK directory (i.e. Library/Android/sdk/extras/android/m2repository/com/android/support/design for Mac OS X).

Change Log

Changes in Support Library v23

  • Resources.getColor() has been deprecated. You must now use ContextCompat.getColor() instead. See this Stack Overflow article or the official API documentation.

Changes in Support Library v23.1

TextInputLayout and EditText now includes the ability to add a character counter. (view guide)

A snap flag can also be added to the list of scrolling effects declared in AppBarLayout. (view guide)

A setOnDragListener() method has been added to AppBarLayout. (view guide)

An aspectRatio attribute is now supported in PercentRelativeLayout. (view guide)

A new item animation interface for the RecyclerView. (view guide)

Custom views can be provided for NavigationView rows. (view guide)

Changes in Support Library v23.1.1

  • NavigationView now contains a getHeaderView() method (view guide)

Changes in Support Library v23.2

  • Added support for bottom sheets. (view guide)
  • Added setup instructions for vector drawables. (view guide)

Changes in Support Library v24.2.0

TextInputLayout and EditText now includes the ability to add password visibility toggles. (view guide)

Added DiffUtil class for RecyclerView. (view guide)

Support v4 library modules have been broken apart but cannot be used to reduce APK size because the fragment library still depends on all other related modules. (view guide)

Transitions API backported to Android 4.0 but does not include support for activity/fragment transitions. (view guide)

Changes in Support Library v25.0.0

  • Bottom Navigation Views support added (view guide)

References

  • https://medium.com/android-bites/first-steps-with-the-design-support-library-8dcf06230ddd
  • http://android-developers.blogspot.com/2015/05/android-design-support-library.html
  • https://github.com/chrisbanes/cheesesquare
  • http://hmkcode.com/material-design-app-android-design-support-library-appcompat/
  • https://medium.com/ribot-labs/exploring-the-new-android-design-support-library-b7cda56d2c32
  • https://plus.google.com/+AndroidDevelopers/posts/XTtNCPviwpj
  • https://code.google.com/p/android/issues/list?can=1&q=label%3AVersion-22.2.1
  • https://plus.google.com/+AndroidDevelopers/posts/RZutBRWN6sH?linkId=17978076
  • https://medium.com/@chrisbanes/appcompat-v23-2-age-of-the-vectors-91cbafa87c88#.dvbsz7sts
  • https://plus.google.com/+AndroidDevelopers/posts/iTDmFiGrVne
  • https://www.reddit.com/r/androiddev/comments/4y70e7/android_support_library_v242_released/

Share this:

  • Click to print (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Google+ (Opens in new window)

Recent Posts

  • android 3rd party animation libraries recommended by tacademy
  • android animation 정리
  • android 중급 2강 Thread(스레드)2  tacademy
  • rfid project
  • android 중급 1강 Thread(스레드)1  tacademy

Recent Comments

    Archives

    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
    • October 2014
    • September 2014
    • August 2014
    • July 2014
    • June 2014
    • May 2014
    • April 2014
    • March 2014
    • February 2014
    • January 2014
    • December 2013
    • November 2013
    • October 2013
    • September 2013
    • August 2013
    • July 2013
    • June 2013
    • May 2013
    • April 2013
    • March 2013
    • February 2013
    • January 2013
    • December 2012
    • November 2012
    • October 2012
    • September 2012

    공부했던 내용

    android api app brian class core core data css data database development django doc documentation drupal facebook firebase function google http image ios jacob java javascript jquery laravel layout library machine learning mysql notification php plugin python swift type watch wear wearable web 개념 개발 설명 자바스크립트
    May 2017
    M T W T F S S
    « Apr   Jun »
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  
    © Copyright 2021 - Jacob is studying on programming
    Contango Theme ⋅ Powered by WordPress