android 属性中src和background的区别

最近做一个简单的界面,就是imageview实现一个长度图片的滚动效果,结果发现设置为background时,图片缩放为界面的大小,没有滚动效果,最后使用src属性存放的就是原始的图片,不是拉伸,要想图片拉伸要使用android:scaleType=""手动指定拉伸效果

 

 

Enum Values
ImageView.ScaleType CENTER Center the image in the view, but perform no scaling.
ImageView.ScaleType CENTER_CROP Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding).
ImageView.ScaleType CENTER_INSIDE Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).
ImageView.ScaleType FIT_CENTER Scale the image using CENTER.
ImageView.ScaleType FIT_END Scale the image using END.
ImageView.ScaleType FIT_START Scale the image using START.
ImageView.ScaleType FIT_XY Scale the image using FILL.
ImageView.ScaleType MATRIX Scale using the image matrix when drawing.

 

 

你可能感兴趣的:(android,image,less,Matrix)