Suche senden
Hochladen
android drawable
•
3 gefällt mir
•
3,626 views
ukayare
Folgen
Technologie
News & Politik
Melden
Teilen
Melden
Teilen
1 von 27
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Customizing Theme and Style for Material Design : Droid Kaigi 2016
Customizing Theme and Style for Material Design : Droid Kaigi 2016
Yuki Anzai
Android Web app
Android Web app
Sumit Kumar
WindowsPhoneとAndroidの話
WindowsPhoneとAndroidの話
ukayare
TypeScript0.9
TypeScript0.9
ukayare
残パン会の発表
残パン会の発表
ukayare
スマートフォンの第3勢力
スマートフォンの第3勢力
ukayare
ハトでもわかるオブジェクト指向
ハトでもわかるオブジェクト指向
ukayare
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Empfohlen
Customizing Theme and Style for Material Design : Droid Kaigi 2016
Customizing Theme and Style for Material Design : Droid Kaigi 2016
Yuki Anzai
Android Web app
Android Web app
Sumit Kumar
WindowsPhoneとAndroidの話
WindowsPhoneとAndroidの話
ukayare
TypeScript0.9
TypeScript0.9
ukayare
残パン会の発表
残パン会の発表
ukayare
スマートフォンの第3勢力
スマートフォンの第3勢力
ukayare
ハトでもわかるオブジェクト指向
ハトでもわかるオブジェクト指向
ukayare
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
atsushi061452
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Toru Tamaki
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
WSO2
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
sn679259
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Toru Tamaki
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
CRI Japan, Inc.
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
CRI Japan, Inc.
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Hiroshi Tomioka
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
Weitere ähnliche Inhalte
Kürzlich hochgeladen
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
atsushi061452
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Toru Tamaki
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
WSO2
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
sn679259
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Toru Tamaki
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
CRI Japan, Inc.
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
CRI Japan, Inc.
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Hiroshi Tomioka
Kürzlich hochgeladen
(11)
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Empfohlen
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
Empfohlen
(20)
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
android drawable
1.
Drawable Resouceの話
2.
Drawable? ● Androidで表示するUIパーツを1つの描画コン ポーネントとしてまとめておくもの ● res/drawable/ 以下に置く ○
画像ファイル(png推奨) ○ xmlファイル(後で説明する決められたフォーマットでか かれたもの)
3.
アクセスの方法 res/drawable/hoge_huga.pngを作成した場合 ● Java ○ R.drawable.hoge_huga ●
xml(layout等) ○ @drawable/hoge_huga で呼び出せる
4.
各Drawableリソースの説明 一覧 ● bitmap ● 9-patch ●
layer-list=LayerDrawable ● selector=StateListDrawable ● level-list=LevelListDrawable ● transition=TransitionDrawable ● inset=InsetDrawable ● clip=ClipDrawable ● scale=ScaleDrawable ● shape=ShapeDrawable
5.
bitmap ● 通常の画像リソース ● 入れた画像がそのまま表示されるわけではない (見た目的には変わってないけど) ○
アプリをビルドするときに最適化が行われて圧縮される 可能性がある ○ メモリ消費を抑えたりするためのものなのであまり意識 しないでもいいかも ○ (あまりないけど)直接のbitmapデータがほしい場合は (res/raw/)以下において読む込むようにする(アクセス は前述したdrawableをrawに変えるだけ)
6.
bitmap xml <ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/myimage" />
7.
xml bitmap bitmapファイルにオプションを いろいろ定義できる ● アンチエイリアス ●
タイル(敷き詰め) xml <bitmap xmlns:android="http://schemas.android. com/apk/res/android" android:src="@drawable/ic_launcher" android:tileMode="repeat" />
8.
9-patch ● 伸縮可能なbitmapリソース ● 説明済みなのでスキップ
9.
layer-list ● 複数のdrawableを重ねあわせ表示を行うため のもの ● リソースを使い回したりするときに利用する
10.
layer-list <?xml version="1.0" encoding="utf-8"?> <layer-list
xmlns:android="http://schemas.android. com/apk/res/android"> <item> <bitmap android:src="@drawable/ic_launcher" android:gravity="center" /> </item> <item android:top="10dp" android:left="10dp"> <bitmap android:src="@drawable/ic_launcher" android:gravity="center" /> </item> <item android:top="20dp" android:left="20dp"> <bitmap android:src="@drawable/ic_launcher" android:gravity="center" /> </item> </layer-list>
11.
selector ● 各状態によって表示を変化させたりできる ● タップ前、タップ中、タップ後で表示するものを変 更したりできる タップ前 タップ中
12.
selector <?xml version="1.0" encoding="utf-8"?> <selector
xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/ic_launcher" /> <item android:state_focused="true" android:drawable="@android:drawable/ic_delete" /> <item android:state_hovered="true" android:drawable="@android:drawable/ic_menu_manage" /> <item android:drawable="@android:drawable/ic_menu_edit" /> </selector>
13.
level-list ● 閾値を設けてそれによって表示を制御することが出来る ● 10回タップしたら色を変える。と言ったことが可能 ●
閾値は複数設定可能 <?xml version="1.0" encoding="utf-8"?> <level-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/status_off" android:maxLevel="0" /> <item android:drawable="@drawable/status_on" android:maxLevel="1" /> </level-list>
14.
transition ● 2つのdrawableリソースを利用 ● 2つをフェードで入れ替え表示が出来る ●
フェード速度は制御可能(開始や速度の制御は Javaで行う) <?xml version="1.0" encoding="utf-8"?> <transition xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/on" /> <item android:drawable="@drawable/off" /> </transition>
15.
inset ● 特定のdrawableに差し込むためのdrawable ● 用意されたdrawable領域に対していれるリソー スが小さい場合に利用するといい ○
layout側でmerginやpadding設定でも代用可能 <?xml version="1.0" encoding="utf-8"?> <inset xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/background" android:insetTop="10dp" android:insetLeft="10dp" />
16.
clip ● 設定したlevelパラメータによって表示度合いを 制御できる ● levelは0~10,000まで(0で何も表示されない) <clip xmlns:android="http://schemas.android. com/apk/res/android" android:drawable="@drawable/android" android:clipOrientation="horizontal" android:gravity="left"
/>
17.
scale ● 参照するdrawableリソースの表示サイズを制御 できる <scale xmlns:android="http://schemas.android. com/apk/res/android" android:drawable="@drawable/logo" android:scaleGravity="center_vertical|center_horizontal" android:scaleHeight="80%" android:scaleWidth="80%"
/>
18.
shape ● 幾何学系の図形を描画出来る ● 細かい設定を行えば画像リソースを用意しなく てもよい
19.
shapeの利点 ● 表示されるときはベクター画像として扱われる ○ 複数解像度に合わせてリソースを用意しないと行けない という問題がない ●
プログラム上での操作が割と容易 ○ アクションに応じて色を変えると言った事が行える ● 単純にファイルサイズが小さい ○ アプリサイズを押さえられる
20.
shapeだと難しいもの ● 文字のような複雑な図形 ○ アイコンなどは画像として用意した方がよい ○
例:公式アプリのイイネボタン等 ○ 共通のリソースが使えるのであればそれを使ってよい ● ボタンなどの縦横比が変化しやすい素材 ○ nine-patchでがんばる? ● API level(OSのバージョン)によって一部バグが 存在する(API level 10以下) ● 大体CSSで作成できるものは作れる感覚
21.
shapeで作れるものの例 これ 参考 http://www.marineroad.com/staff-blog/4095.html
22.
(xml) <layer-list xmlns:android="http: //schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <gradient android:startColor="#CCEEEEEE" android:endColor="#CC222222" android:angle="90" android:type="linear"/> <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp"
/> </shape> </item> <item android:top="2dp" android:left="2dp" android:right="2dp" android:bottom="2dp"> <shape android:shape="rectangle"> <gradient android:startColor="#222222" android:endColor="#DDDDDD" android:angle="90" android:type="linear"/> <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp" /> </shape> </item> <item android:top="2dp" android:left="2dp" android:right="2dp" android:bottom="2dp"> <shape android:shape="rectangle"> <gradient android:startColor="#CC222222" android:endColor="#22AAFFAA" android:angle="90" android:type="linear"/> <corners android:bottomRightRadius="10 android:bottomLeftRadius="10d android:topLeftRadius="10dp" android:topRightRadius="10dp" </shape> </item> <item android:top="32dp" android:left="2dp" android:right="2dp" android:bottom="2dp"> <shape android:shape="rectangl <solid android:color="#4000000 <corners android:bottomRightRadius= android:bottomLeftRadius="1 android:topLeftRadius="0dp" android:topRightRadius="0dp </shape> </item> </layer-list>
23.
layer-list shape shape shape
24.
animation系リソース ● res/anim以下に設置 ● xmlで記述する ●
設定を書いてあるだけで開始等の制御はJava 側で行う
25.
おまけ:デフォルトのリソースも使おう ● 以下に存在するリソースの一覧がある ○ http://developer.android.com/reference/android/R. drawable.html ●
実際に表示されるとどういうものかを見たいとき ○ http://androiddrawableexplorer.appspot.com/ ● ただしOSのversionによって表示されるものが異なる場合あ り ● 実機で確認したほうが良い ○ http://qiita.com/gfx/items/b0e36c4f871b2018c42a ● 上のリストに存在しないが実際あるものもある ○ 各versionのSDKのdata/res/drawable-mdpi をみる
26.
リソースを入れるときのファイル名 ● camelCase、もしくはsnake_caseでファイル名 を記述して命名規則は統一 ● 命名規則についてはこの辺を参照するといいか も ○
http://www.kojion.com/android/naming_rule.html ● Androidがデフォルトでおいてあるdrawableリ ソースはすべてsnake_case ○ 公式に習ってsnake_caseで統一 ○ 公式と区別できるようにするためにcamelCaseにする ■ エンジニアと相談して決めましょう
27.
Androidの基本的なアイコン命名規則 ● アイコン ○ ic_xxxxxx ●
ランチャー ○ ic_launcher_xxxxx ● メニュー・アクションバー ○ ic_menu_xxxxx ● ステータスバー ○ ic_stat_notify_xxxx ● タブ ○ ic_tab_xxxxxx ● ダイアログ ○ ic_dialog_xxxxx
Jetzt herunterladen