SlideShare a Scribd company logo
1 of 20
Download to read offline
イベント
【宜野湾】第2回 Android勉強会 全6回
■レイアウト構築について
■イベントについて
■リスト表⽰について
レイアウト構築について
■テキスト:TextView
■画像:ImageView像
■レイアウト:
LinearLayout/RelativeLayout
■View
■様々なView
レイアウト構築について
■textSize:サイズ指定単位 sp
setText(CharSequence,TextView.BufferType)
■textColor:⾊指定 #ffffffff ARGB
setTextColor(ColorStateList)
■textStyle:Bold/Italic
setTypeface(Typeface)
■gravity:左寄せ、中央、右寄せ等
setGravity(int)
■drawableStart:テキストと画像設定
setCompoundDrawablesWithIntrinsicBounds(Drawable,Drawable,
Drawable,Drawable)
■テキスト
XML
レイアウト
レイアウト構築について
■src:画像設定
setImageResource(int)
■adjustViewBounds:縦横⽐維持設定
setAdjustViewBounds(boolean)
■scaleType:リサイズ/配置設定
setScaleType(ImageView.ScaleType)
ScaleType
・matrix:Matrixでの描画
・fitXY:縦横最⼤表⽰、アスペクト⽐無視
・fitStart:左上端に寄せる
・fitCenter:中央に寄せる
・fitEnd:右下端に寄せる
・center:中央に寄せる
・centerCrop:余⽩含め中央寄せ
・centerInside:余⽩除く中央寄せ
■画像
XML
レイアウト表⽰
レイアウト構築について
■設定項⽬
layout_above
layout_alignBaseline
layout_alignTop
layout_alignBottom
layout_alignLeft
layout_alignRight
layout_alignParentTop
layout_alignParentBottom
layout_alignParentLeft
layout_alignParentRight
layout_alignWithParentIfMissing
layout_below
layout_centerHorizontal
layout_centerInParent
layout_centerVertical
layout_toLeftOf
layout_toRightOf
■レイアウト:RelativeLayout 相対配置
レイアウト表⽰
レイアウト構築について
■orientation:縦横設定
vertical | horizontal
setOrientation(int)
■layout_weight:⽐率指定
数値での設定
■レイアウト:LinearLayout ⼀列配置
XML レイアウト表⽰
レイアウト構築について
■background:背景⾊設定
■visibility:表⽰設定
setVisibility(int)
■View
xml レイアウト表⽰
レイアウト構築について
■ViewPager
■ListView
■GridView
■ScrollView
■Toolbar
■CheckBox
■RadioButton
■Spinner etc…
■様々なView
レイアウト構築について
使⽤するView
■LinerLayout
■RelativeLayout
■ImageView
■TextView
■下記を作っていきます
レイアウト構築について
■activity_main.xml
とりあえずxmlを書きましょう!
ただ別紙参照です!
パワポに⼊らない。。。
レイアウト構築について:activity_main.xml
layout_width=0dp
weight=1
がポイント
■LinearLayout
レイアウト構築について:activity_main.xml
layout_centerInParent=true
layout_below=“@id/text”
toEndOf=“@id/text”
toStartOf=“@id/text”
等がポイント
■RelativeLayout
イベントについて
■OnClickListener:クリックイベント
■OnTouchListenere:タッチイベント
■OnItemClickListener:リストク
リックイベント
など
■よく活⽤するイベント
※別紙参照
リスト表⽰ついて
■ListViewを設定・取得
■ArrayAdapterを設定
■ListViewにAdapterを設定
■シンプルなリスト表⽰
リスト表⽰ついて
■xmlにListViewを設定
■javaファイルでListViewを取得
■ListViewを設定・取得
activity_main.xml
MainActivity.java
リスト表⽰ついて
■Adapterインスタンスを⽣成
■Adapterに値を設定
ポイント1
レイアウト設定
Android.R.layout.simple_list_item_1
ポイント2
値の追加
adapter.add(“Position “ + i);
■ArrayAdapterを設定
MainActivity.java
リスト表⽰ついて
■setAdaspter(adapter);
■ついでにアイテムクリック
■ListViewにAdapterを設定
MainActivity.java
リスト表⽰ついて
■完成!
リスト表⽰について:注意点
■テキスト表⽰であれば簡単
■カスタマイズすると⼀度はハマる
■だが基本的にカスタマイズが求められる
■Adapterにも⾊々な種類がある
- ArrayAdapter
- SimpleAdapter
- BaseAdapter ※⼀番おすすめ!
まとめ
■レイアウト構築の基本がわかった
- Layout, Text, Image etc…
■主要となるイベント設定がわかった
■簡単なリスト表⽰⽅法がわかった
■List表⽰についてなんとなく、ハマるポイン
トが存在しているという事実を知った

More Related Content

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)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 2024How 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 InsightsSocial 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 2024Trends 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 summary5 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 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 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 IntentGoogle'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 How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe 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...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...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...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Andorid アプリ 開発 勉強会 第2回