我知道这是一个非常愚蠢的问题,但 ImageView 所需要的只是设置一个 Image,A View 也可以 setBackgroundDrawable,我的问题是什么时候应该使用 ImageView 而不是 View。谢谢你 。
3 回答
View 是 ImageView 的超类。您可以在视图中绘制所有 android 控件事件,例如 (Button, EditText,TextView, CheckBox)
ImageView 你可以在 imageView 中绘制一个 Image。
您不能直接在 View 上添加图像,但可以将 View 类型转换为 imageView。
你应该在 ImageView 上添加图像 & ImageView 将被添加到 Layout(View group)
Imageview : Displays an arbitrary image, such as an icon. The ImageView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the image so that it can be used in any layout manager, and provides various display options such as scaling and tinting.
View : Provides classes that expose basic user interface classes that handle screen layout and interaction with the user.
Hope this helps.
For more details :
Image view : Android ImageView
View : Android View