すべては, 以下にあるやつ今現在最新のサンプルUI系をLollipopで動かす.

AndroidStudio の ImportSample のプレビューが表示されないので並べて置くと何かと便利かななどと思い.

パーツやふるまいの名前が分かればそれで良かったのでYouTubeのGIF書き出しでやろうかと思いましたが, 一般公開間近の非公開ステータス.

Nexus6でやってます.
こんな感じで40個くらい.
以下から順不同で.
すべては, 以下にあるやつ今現在最新のサンプルUI系をLollipopで動かす.

AndroidStudio の ImportSample のプレビューが表示されないので並べて置くと何かと便利かななどと思い.

パーツやふるまいの名前が分かればそれで良かったのでYouTubeのGIF書き出しでやろうかと思いましたが, 一般公開間近の非公開ステータス.

Nexus6でやってます.
こんな感じで40個くらい.
以下から順不同で.
Androidアプリでメソッド数が65536を超える場合は少し手間が掛かっていました.
Androidでメソッド数が65536を超えた時の対処方法 - Qiita
GoogleAnalyticsやGoogleMapなどを利用できるライブラリ com.google.android.gms:play-services ですが、実は使っている機能は1つか2つということが多いのではないでしょうか。
com.googleは18513個もメソッドがあるので、これを節約するだけでかなりメソッドの数が減ります。
このよく言われている「com.google.android.gms:play-services」がでかすぎという話.
必要なものだけピックアップして使えるようになったようです.

Setting Up Google Play Services | Android Developers
自動で, com.google.android.gms:play-services-base:6.5.87 が読み込まれたりするし, どれを使うべきなのかわかりづらいようなものもあるように思えたり.
あと, 公式ドキュメントや AndroidStudio の自動チェックで, 「推奨」から「非推奨」と言われ始めたバージョン記述「+」で書かれていたり.
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.google.android.gms:play-services-fitness:6.5.+'
compile 'com.google.android.gms:play-services-wearable:6.5.+'
これらの「+」記述は, 最新 Android Studio 1.0 でも警告される.

こう書いてるけど.
At the time of writing, the correct version to use is 6.5.87. As this is a very granular number, it will get updated quite quickly, so be sure the check the latest version when you are coding. Often people will use a ‘+’ to denote versions, such as 6.5.+ to use the latest 6.5 build. However, it’s typically discouraged to use a ‘+’ as it can lead to inconsistencies.
でも, やっぱり「+」は怖くないですか.
Google Play services and DEX method limits | Android Developers Blog
最近, テレビでもCMやってます.


自分の好みのパーツを組み合わせて, かわいいのか, ゆるキャラっぽいような, そうでもないような, 微妙なキャラを作ったりできます.
Androidify - Google Play の Android アプリ
そんな「Androidify」な無料壁紙アプリを入れてみました.
触ると反応して動きます.



以下からダウンロードなどどぞ.
https://svg-android.googlecode.com/files/svgwallpaper.apk
微妙ですが, 色目がきれいですし.
ちと, よりすぎなんだよな...
たくさんの画像リソースが公開されています.
![]()
【使える! 即保存】 github で公開されている Material design icons 一覧
どれもいいかんじです.
で, これ一覧で好きなアイコンを選んだあと,
zipをダウンロード/展開したあとどれを使ったらいいのか.
たとえば, 一覧で「error」アイコンを使おうとすると
こんなにある.
./alert/drawable-hdpi/ic_error_black_18dp.png ./alert/drawable-hdpi/ic_error_black_24dp.png ./alert/drawable-hdpi/ic_error_black_36dp.png ./alert/drawable-hdpi/ic_error_black_48dp.png ./alert/drawable-hdpi/ic_error_grey600_18dp.png ...(略)... ./alert/drawable-xxxhdpi/ic_error_red_48dp.png ./alert/drawable-xxxhdpi/ic_error_white_18dp.png ./alert/drawable-xxxhdpi/ic_error_white_24dp.png ./alert/drawable-xxxhdpi/ic_error_white_36dp.png ./alert/drawable-xxxhdpi/ic_error_white_48dp.png
ディレクトリの構造はこんなかんじになってる.
material-design-icons-master ├── action │ ├── drawable-hdpi │ │ ├── ic_error_red_18dp.png │ │ ├── ic_error_red_24dp.png │ │ ├── ic_error_red_36dp.png │ │ ├── ic_error_red_48dp.png │ ├── drawable-mdpi │ ├── drawable-xhdpi │ ├── drawable-xxhdpi │ ├── drawable-xxxhdpi
アイコンファイルを選択する他に
いくつか決めなければならないことがあったりします.
・dpi
・color
・dip
「色」は見て決めれるけども...
以下を見ながら, dip(サイズ/スケール) と
対象ファイル, 新しいファイル名を決める.
| Launcher | ic_launcher_***.png | 48dp |
| Action Bar | ic_menu_***.png | 32dp |
| Small/Contextual | ic_***.png | 16dp |
| Notification | ic_stat_notify_***.png | 24dp |
Iconography | Android Developers
細かくいろいろ区別できるのだろうけど,
Android Studioのプロジェクトデフォルトdpiの構成に
drawableディレクトリはとりあえず合わせよう.
res ├── drawable-hdpi │ └── ic_error.png ├── drawable-mdpi │ └── ic_error.png ├── drawable-xhdpi │ └── ic_error.png ├── drawable-xxhdpi │ └── ic_error.png
などとシコシコ手動でやってみたがめんどうなので
zip の展開後のディレクトリ構成とファイル名を
あらかじめ変更しておけば, フォルダごと上書きできそうなので
一括でスクリプトで以下に変更しておく.
{category}/drawable-{dpi}/ic_{name}_{color}_{dip}.png
↓
{category}/{name}/{color}/{dip}/drawable-{dpi}/ic_{name}.png
<?php
/**
Restructure dirs/files tree.
https://github.com/google/material-design-icons
Usage:
$ curl -LO https://github.com/google/material-design-icons/archive/master.zip
$ unzip material-design-icons-master.zip
$ ls
... material-design-icons-master ...
$ php restructure.php
{category}/drawable-{dpi}/ic_{name}_{color}_{dip}.png
-> {category}/{name}/{color}/{dip}/drawable-{dpi}/ic_{name}.png
~/material-design-icons-master_new $ tree .
.
├── action
│ ├── 3d_rotation
│ │ ├── black
│ │ │ ├── 18dp
│ │ │ │ ├── drawable-hdpi
│ │ │ │ │ └── ic_3d_rotation.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ │ └── ic_3d_rotation.png
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ │ └── ic_3d_rotation.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ │ └── ic_3d_rotation.png
│ │ │ │ └── drawable-xxxhdpi
│ │ │ │ └── ic_3d_rotation.png
│ │ │ ├── 24dp
│ │ │ │ ├── drawable-hdpi
│ │ │ │ │ └── ic_3d_rotation.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ │ └── ic_3d_rotation.png
...
*/
foreach (glob('material-design-icons-master/*/*/*.png') as $file) {
if (is_file($file) && preg_match('@/drawable@', $file)) {
$path_parts = pathinfo($file);
$filename = $path_parts['filename'];
$dirs = explode('/', $path_parts['dirname']);
$category = $dirs[1];
$dip = substr($filename, strrpos($filename, '_') + 1);
$dpi = substr($dirs[2], strpos($dirs[2], '-') + 1);
$filename = substr($filename, 0, strpos($filename, '_' . $dip));
$name_color = substr($filename, strpos($filename, '_') + 1);
$color = substr($name_color, strrpos($name_color, '_') + 1);
$name = substr($name_color, 0, strpos($name_color, '_' . $color));
$path = sprintf('%s_new/%s/%s/%s/%s/drawable-%s/ic_%s.png',
$dirs[0], $category, $name, $color, $dip, $dpi, $name);
mkdir(dirname($path), 0777, true);
copy($file, $path);
echo $file . "\n";
echo '-> ' . $path . "\n";
}
}
構成変更後はこんなかんじに.
~/material-design-icons-master_new $ tree . . ├── action │ ├── 3d_rotation │ │ ├── black │ │ │ ├── 18dp │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── ic_3d_rotation.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_3d_rotation.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── ic_3d_rotation.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── ic_3d_rotation.png │ │ │ │ └── drawable-xxxhdpi │ │ │ │ └── ic_3d_rotation.png │ │ │ ├── 24dp │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── ic_3d_rotation.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_3d_rotation.png ...
こうしておけば,
使いたいアイコンの色, 利用場所(dip) を考えながら,
GUI上でディレクトリごと上書きで,
IDE上の res ディレクトリ以下にコピーすればよい.
![]()
よくみると, IDE側の drawable-*** のディレクトリ名は微妙に違ってたりするが(笑)
今, 話題の「Material Design」.
アイコンリソースが公開されています.
いちいち zip ダウンロードして眺めるのもなんなので,
一覧にしておく.
同梱物は以下のようです.
SVG versions of all icons in both 24px and 48px flavours
SVG and CSS sprites of all icons
1x, 2x icons targeted at the Web (PNG)
1x, 2x, 3x icons targeted at iOS (PNG)
Hi-dpi versions of all icons (hdpi, mdpi, xhdpi, xxhdpi, xxxhdpi) (PNG)
あっ..