Create a Material Design-style Android app-application topic, materialandroid
All my articles first published on my blog, welcome to attention, address: http://blog.isming.me
Android 5 was officially released yesterday, And the android developer website was also updated. The Android Application Guide for creating Material Design was added, and the Support Library was also updated, added some Material Design-style controls and animations in the support library. Here we will give you a brief introduction to how to develop a material design-style Android Application.
Android 5 adopts the Material Design style
Android provides three Material Design Theme styles.
They are:
@android:style/Theme.Material (dark version) @android:style/Theme.Material.Light (light version) @android:style/Theme.Material.Light.DarkActionBar
Light material theme
Light material theme
Dark material theme
Dark material theme
We can use these three Theme to define our Theme, for example:
<resources> <!-- inherit from the material theme --> <style name="AppTheme" parent="android:Theme.Material"> <!-- Main theme colors --> <!-- your app branding color for the app bar --> <item name="android:colorPrimary">@color/primary</item> <!-- darker variant for the status bar and contextual app bars --> <item name="android:colorPrimaryDark">@color/primary_dark</item> <!-- theme UI controls like checkboxes and text fields --> <item name="android:colorAccent">@color/accent</item> </style></resources>
We can modify the color of the word or background at each position. The name of each position is shown in:
Customizing the material theme
I will give a brief introduction to it. Let's explore it more specifically.
Earlier versions use the Material Design style
To use the Material Design style in earlier versions, you need to use the latest support library (version 21). You can directly introduce the project, or use gradle to build and increase the compile dependency:
dependencies { compile 'com.android.support:appcompat-v7:+' compile 'com.android.support:cardview-v7:+' compile 'com.android.support:recyclerview-v7:+'}
Put the above AppTheme style in res/values-v21/style. xml, and add an AppTheme IN res/values/style. xml, as follows:
<!-- extend one of the Theme.AppCompat themes --><style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> <!-- customize the color palette --> <item name="colorPrimary">@color/material_blue_500</item> <item name="colorPrimaryDark">@color/material_blue_700</item> <item name="colorAccent">@color/material_green_A200</item></style>
In this way, Material Design can also be implemented in many ways. However, because low versions do not support immersive status bars, some results still cannot be implemented.
PS: write so much. Use CardView and RecyclerView for the next write. Create a List and Card layout for Material Design. (I am not good at English, and may not understand it in some places .)
Refer:Http://developer.android.com/training/material/theme.html
Original article address: Workshop.
What is Material Design?
Google released the brand new Design language Material Design. Google said the design language aims to provide a more consistent and broader "Look and Feel" for mobile phones, tablets, desktops, and other platforms ".
Matias Durate, head of user experience at Google's Android operating system, said in a keynote speech at today's I/O Developer Conference: "We imagine that if pixels are colored, what kind of scenarios is there depth? What if there is a material that can change its texture? This imagination eventually led us to develop a Design language called Material Design ."
Some important functions of the Material Design language include the upgraded version of the system font Roboto. The color is brighter and the animation effect is more prominent. Dulat also briefly talked about some changes to the new framework, which was also published in google.com/design today. Google's idea is to let developers on the Google platform master this new framework, so that all applications have a uniform appearance, just like the design principles Apple has proposed to developers.
Google has also re-designed its flagship application based on the new design language, including Gmail and Calendar for Android and web pages. You may still remember that you have recently seen articles about these changes. Some blogs have mastered the leaked screenshots, And the UI is more clean and simpler as the Gmail is redesigned.
On the Android platform, this new style is called Material. It supports various new animation effects, built-in real-time UI shadows, and hero elements that can be switched between different screens.
How can I check whether Android applications are developed according to Android Design?
Import java. io. CharArrayReader; import java. util. Arrays; import java. util. collections;
Public class Test {
Public static void main (String [] args) {// first (); // second (); // third (); // fourth (); // define thly (); // sixth (); // zimuduiying (); // Xunhuan (); Max ();
}
/*** "Compare the size of two strings according to the following requirements and return the comparison result: 1. Compare the size of the two strings. 2. Case Insensitive 3. In Lexicographic Order, if the first string is greater than the second string *, the return value is greater than 0. If the first string is equal to the second string, the return value is equal to 0, if the first string is less than the second string, return less than 0. 4. Example * compareToIgnoreCase ("HARD", "hark") returns a result smaller than 0. "*/
Public static void first () {String a = "HARK"; String B = "hello"; if (. compareToIgnoreCase (B)> 0) {System. out. println ("1");} else if (. compareToIgnoreCase (B) <0) {System. out. println ("-1");} else {System. out. println ("0 ");}}
/*** "To a two-dimensional array inArr [] [], write a method to get the minimum value of each column and output it to a one-dimensional array outArr. For example, if inArr [] [*] = {, 3}, {6, 5}, outArr [] =, 3} "*/public static void second () {int inArray [] [] = {1, 8, 3}, {6, 5 }}; int outArray [] = new int [3]; int min = 0;
For (int col = 0; col <3; col ++) {int row = 0; try {min = inArray [row] [col];
} Catch (ArrayIndexOutOfBoundsException e) {row ++; // If a row out of bounds is added to a row min = inArray [row] [col];} for (row = 0; row <outArray. length; row ++) {try {if (min> inArray [row] [col]) {min = inArray [row] [col] ;}} catch (Exception e) {contin ...... remaining full text>