androidソースコード 〜View.java

*ファイルの場所
/frameworks/base/core/java/android/view/View.java

*前文の抜粋


This class represents the basic building block for user interface components. A View
occupies a rectangular area on the screen and is responsible for drawing and
event handling. View is the base class for widgets, which are
used to create interactive UI components (buttons, text fields, etc.). The
ViewGroup subclass is the base class for layouts, which
are invisible containers that hold other Views (or other ViewGroups) and define
their layout properties.

〜拙訳
このクラスはユーザインターフェイスのための基本的なブロックである。
Viewは画面上に矩形(四角)の領域を確保し、
描画やイベントハンドリングを行う。
Viewとはwidgetsの基本クラスであり、
widgetとはインタラクティブなUI部品(ボタン、テキストフィールドetc)を形成する。
子クラスの android.view.ViewGroup は layouts の基本クラスである。
layouts とは他のViewやViewGroupを保持する見えないコンテナであり、
レイアウト上の性質を決定する。


*抜粋


"Note: The Android framework is responsible for measuring, laying out and
drawing views. You should not call methods that perform these actions on
views yourself unless you are actually implementing a
ViewGroup."

Viewの配置はAndroidフレームワークがやってくれるから、
やんなくていい。


"To implement a custom view, you will usually begin by providing overrides for
some of the standard methods that the framework calls on all views. You do
not need to override all of these methods. In fact, you can start by just
overriding onDraw(android.graphics.Canvas)."

特別なビューを実装する場合、メソッドをオーバライドする必要があるけど、
全部に対してする必要はない。
実際のところ、 onDraw(Canvas) だけオーバライドしてやってみてもよい。



"View IDs need not be unique throughout the tree, but it is good practice to
ensure that they are at least unique within the part of the tree you are
searching."

ViewのID属性はすべてを通じてユニークである必要はないけど、
探索中のツリー内では一意であるほうがよい。


次回はandroidのView(TextViewとか)をみたいと思います。