[AndroidStudio]Androidエンジニア必須のマテリアルデザインを簡単に実装できるMaterialDesignLibraryの導入
はじめに
マテリアルデザインはシンプルでフラットなGoogleが提唱しているAndroidの新しいデザイン模様です。
Android開発でマテリアルデザインを取り込むのをサポートしているライブラリを導入してみます。
マテリアルデザインについては以下を参照ください
https://www.google.com/design/spec/material-design/introduction.html#
MaterialDesignLibraryについて
MaterialDesignLibraryはAndroidのマテリアルデザインをサポートしているライブラリです。
※starも現在4700ついてました
実際どういったライブラリかどうかは以下のデモアプリで確認できます
https://play.google.com/store/apps/details?id=com.gc.demomaterialdesign
MaterialDesignLibraryリポジトリ詳細は以下を確認ください
https://github.com/navasmdc/MaterialDesignLibrary
プロジェクトへMaterialDesignLibraryの取り込み
まずは導入するプロジェクトを作成してください。
プロジェクト直下へ移動して以下のコマンドでライブラリをgitのサブモジュールとして取り込みます。
※GitHubのリポジトリより直接ダウンロードして配置しても問題ありません
$ git submodule add https://github.com/navasmdc/MaterialDesignLibrary.git
$ git submodule init
$ git submodule update
プロジェクトへMaterialDesignLibraryを読み込み
プロジェクトのapp/build.gradle(AndroidStudioではGradleScriptでModule: appのbuild.gradle)へ以下を追加します
repositories {
jcenter()
}dependencies {
compile ‘com.github.navasmdc:MaterialDesign:1.5@aar’
}
※dependenciesはプロジェクト新規で存在しているため、compile構文を一行追加でOKです
ここまでで取り込み完了です
MaterialDesignLibraryのViewを使ってみる
レイアウトの外枠は以下を設置してください
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:materialdesign="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" > </RelativeLayout>
上記のRelativeLayout内へボタンを配置してみます
<com.gc.materialdesign.views.ButtonFlat android:id="@+id/buttonflat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#1E88E5" android:text="Button" />
これでボタンが表示されればOKです。簡単にマテリアルデザインのビューを実装できました。
ボタンのイベントコールバックなどもAndroidデフォルトのボタンと変わらないので簡単です。
その他Viewの詳細についてはREADMEより確認してください
https://github.com/navasmdc/MaterialDesignLibrary
その他おすすめの備忘録
- [iOS][Android]iOS/Android開発者が知ってた方が良いサイト一覧
- [Rails] pry(REPL環境)へHirb(モデル出力を綺麗に表示) を導入する
- [Android]使用していない画像ファイルをまとめて削除する(Eclipse版)
- [Android]GradleコマンドでAndroidプロジェクト(Gradle環境)を実行
- [iOS]Module compiled with Swift 3.0 cannot be imported in Swift 3.0.2 エラー
- [Android]Gradleファイルで環境ごとに処理を切り分け(APK名・Keystore設定など)
- [iOS][Mac]ライブラリ管理のCarthage(カーセッジ)でライブラリを組み込み
- [Android]各解像度毎の画面サイズについて(デザイナ向け)
- [Grunt]デザイナ向け自動化ツールGruntの開発環境構築から動作確認まで
- [AndroidStudio]jsonライブラリのgsonを導入・jsonデータからModelデータへ変換まで
coffee-break
Don't write code that useless.
1日5杯はコーヒー、カフェオレ飲みます。狭心症のため安静にします☆松本 雄貴
Kotlinでサービスリリース目指す!
iOSでチャットアプリ作成中。自然言語解析LSIを習得中
Mac / Android・iOS / Rails / Oracle
2017年 Lpic L2取得
2012年 Android技術者資格取得
2010年 OracleMasterGold10g取得
2008年 CCNAQiitaもたまに投稿
https://qiita.com/y-matsumoto東京近郊で常駐開発探してる方はこちらよりご連絡ください
SES企業でパートナー会社を探している企業様はこちらよりご連絡ください
スプリットカメラ iOS / Android
音声認識で聞いた日付から曜日当てアプリ Android
ソーシャルタイマー Android
カテゴリー
- ActiveRecord (2)
- Android (52)
- AndroidStudio (10)
- Ansible (1)
- AWS (1)
- Bash (18)
- Blog (7)
- BootStrap (1)
- CentOS (16)
- Chef (1)
- css (2)
- Eclipse (5)
- error (1)
- Facebook (2)
- Firebase (1)
- FuelPHP (16)
- Git (22)
- GitHub (3)
- Gradle (2)
- GraphAPI (1)
- Grunt (1)
- heroku (2)
- illustrator (1)
- iOS (17)
- Java (4)
- Jenkins (1)
- jQuery (3)
- Kotlin (2)
- Mac (22)
- nginx (1)
- Node.js (3)
- peco (1)
- php (5)
- Python (1)
- Rails (16)
- Ruby (11)
- shell (1)
- SNS (1)
- Swift (2)
- tmux (2)
- Vagrant (6)
- Vim (6)
- windows (2)
- WordPress (3)
- zsh (4)
- フリーランス (1)
- ライブラリ (1)
- 勉強会 (2)
- 宣伝 (1)
- 未分類 (2)
最近の投稿
- [MAC]HighSierraでgitプッシュエラー「Unable to negotiate with xxx.xxx.xxx.xxx port xx: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se fatal: Could not read from remote repository.」
- [iOS]iOS11からFacebook,Twitter連携(シェアなど)廃止の対応方法
- [iOS]速報2017AppleSpecialEventのiOS11、iPhone8など発表内容について
- [iOS][Firebase]The default Firebase app has not yet been configured. Add `[FIRApp configure];
- [iOS]2017年9月リリースのiOS11で開発者が対応するべきこと
- 今人気の現金化サービスCASH(キャッシュ)を使ったレビュー
- [Pandoc][Mac]pandocでmarkdownからwordファイル作成
- [Android]映画サマーウォーズの聞いた日付(誕生日)から曜日当てをアプリ音声認識で簡単に実現
- [Android]起動しているActivityを取得するadb shell コマンド
- [Android][Kotlin]kotlin学習で参考になるサイト一覧
2023年6月 月 火 水 木 金 土 日 « 5月 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 アーカイブ
- 2018年5月
- 2017年9月
- 2017年8月
- 2017年7月
- 2017年6月
- 2017年5月
- 2017年2月
- 2017年1月
- 2016年12月
- 2016年7月
- 2016年6月
- 2016年1月
- 2015年12月
- 2015年11月
- 2015年10月
- 2015年9月
- 2015年8月
- 2015年7月
- 2015年6月
- 2015年5月
- 2015年4月
- 2015年3月
- 2015年2月
- 2015年1月
- 2014年12月
- 2014年11月
- 2014年6月
- 2014年5月
- 2014年4月
- 2014年3月
- 2014年2月
- 2014年1月
- 2013年12月
- 2013年11月
- 2013年9月
- 2013年8月
- 2013年7月
- 2013年6月
- 2013年5月
- 2013年4月
- 2013年3月
- 2013年2月
- 2013年1月
- 2012年12月
- 2012年10月
- 2012年5月
- 2010年6月
エントリ