What is the difference between a View
and a ViewGroup
in Android programming?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
A
ViewGroup
is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers. This class also defines theViewGroup.LayoutParams
class which serves as the base class for layouts parameters.View
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.).Reference
View
is the SuperClass of All component likeTextView, EditText, ListView,
etc.. whileViewGroup
is Collection of Views(TextView, EditText, ListView, etc..)
, somewhat like container.Viewgroup inherits properties of views and does more with other views and viewgroup.
See the Android API: http://developer.android.com/reference/android/view/ViewGroup.html
View
View
objects are the basic building blocks of User Interface(UI) elements in Android.View
is a simple rectangle box which responds to the user's actions.EditText
,Button
,CheckBox
etc..View
refers to theandroid.view.View
class, which is the base class of all UI classes.ViewGroup
ViewGroup
is the invisible container. It holdsView
andViewGroup
LinearLayout
is theViewGroup
that contains Button(View), and other Layouts also.ViewGroup
is the base class for Layouts.Below image is the answer. Don't take it too complex.
View
is a basic building block ofUI
(User Interface) in android. A view is a small rectangular box which responds to user inputs. Eg:EditText
,Button
,CheckBox
, etc..ViewGroup
is a invisible container of other views (child views) and other viewgroups. Eg:LinearLayout
is a viewgroup which can contain other views in it.ViewGroup
is a special kind of view which is extended from View as its base class.ViewGroup
is the base class for layouts.as name states View is singular and the group of Views is the
ViewGroup
.more info: http://www.herongyang.com/Android/View-ViewGroup-Layout-and-Widget.html