The difference between setbackgrounddrawable and Setbackgroundresource
Many users do not know the view class provides setbackgrounddrawable and Setbackgroundresource difference is what, while the Android view class many subclasses such as TextView, ImageView have these methods , and there are some differences between these methods, such as Setimagedrawable, Setimagebitmap, and Setimageresource ().
First, the use of setbackgroundxxx, set this view background.
The setbackgrounddrawable parameter is the Drawable object,
The SetBackgroundColor parameter is a color object, such as Color.Red red, or Color.rgb (255,0,0) to make a red
The Setbackgroundresource parameter is a resource ID, such as R.drawable.icon
Second, for the ImageView class has similar setimagexxx
In the same way, Setimagebitmap parameters are bitmap objects, and ImageView also supports matrix objects, such as Setimagematrix's parameters as matrix objects.
Iii. conversion between bitmap and drawable you can view Android123 archive file bitmap and drawable Mutual conversion methods
Learn the difference between Android development-setbackgrounddrawable and Setbackgroundresource from scratch