Android アプリケーション開発では、いつどのイベントが発生するかを知っておくというのは大事な事です。 アクティビティを実装する場合はアクティビティのイベントがいつ発生するか(ライフサイクル)が大事ですし、自分でビューを作る時はビューのイベントを把握しておくとスムーズに実装ができるようになります。 Androidのアクティビティについてはいつどのイベント公式サイトのアクティビティライフサイクルの項目で分かりやすく図示されているのですが、ビューのライフサイクル、イベントの詳細を見つけられなかったため、今回は整理も兼ねてこの記事を公開することにしました。 Android の View は Activity#setContentView() を呼ぶだけでも onFinishInflate(), onAttachedToWindow(),onLayout(),onDraw(),onMeasur
[Android] ViewのonMeasureとかonLayoutについてまとめてみるAndroidアプリを作るとき、よくCustomLayout, CustomViewを作ります。 しかしなんとなく作りたいものが作れるけど、onMeasureとかonLayoutとかよく分からないまま使っていました。 折角なので、View周りの仕組みについて細かく調べてみた。 参考にしたのは、Google I/O 2013のWriting Custom Views for Android。それとAndroid DevelopersのReferenceから。 まずは本家Googleさんの説明を学んでみたいと思います。 Attachment/Detachement onAttachedToWindowYouTubeの4分前後から始まります。Android Developersはココのページ Referenc
androidで厄介なレイアウト回り、onMeasureとonLayoutを理解し、オーバーライドするとより理想のレイアウトに近づけます。 結構挙動が難しいので、長くなってしまいますがこれらの概要です。 (※おおざっぱな流れで細かい部分は違いますが、イメージはつかめると思います) そもそもこの2つは? AndroidではView生成時や、Viewの内容が更新される(TextView#setText()等)で、 View自体の再レイアウトが必要なときに2つが呼び出されます。 以下のようなイメージです。 親ViewのonMeasureが呼び出される 親Viewが子Viewのmeasureを呼び、幅高さを計測させる (2)の情報をもとに、親Viewが自分自身の幅高さを設定する 親ViewのonLayoutが呼び出される 親Viewが子Viewのlayoutを呼び、子Viewの場所を確定させる こ
a slide of architecture components about lifecycle library.
Project GoalsThe goal of the project is to create a beautiful and extensible experience for command-line interface users, built on open web standards. In the beginning, our focus will be primarily around speed, stability and the development of the correct API for extension authors. In the future, we anticipate the community will come up with innovative additions to enhance what could be the simple
This document originated from a bunch of most commonly used links and learning resources I sent to every new web developer on our full-stack web development team. What I'm doing in this document now is trying to provide the complete view angle of modern web (app or page) development ruled by JavaScript, reflect technological advance and help developers to acquire APIs, libraries, tools, services,
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く