[英]Change the Layout Background using image color code in Android
I am using the viewPager
for Gallery
and used "Depth Page Transformation"
for animation
i need to set the background
according to the image
. 我正在为Gallery
使用viewPager
,并为animation
使用了"Depth Page Transformation"
,我需要根据image
设置background
。 The background color
should match with the image
color meaning it should pick the background color
from the image
. 将background color
应与该image
的色彩这意味着它应该选择background color
从image
。 Does any one know this..please tell me. 有谁知道吗..请告诉我。
Loop through all the pixel's color data and average the color values, ignore anything that is a shade of grey or transparent. 遍历所有像素的颜色数据并取平均颜色值,而忽略灰色或透明阴影。 I believe that is what Microsoft does in Windows 7 based on a recent blog post. 我相信这是Microsoft根据最近的博客文章在Windows 7中所做的事情。
See this blog post: http://blogs.msdn.com/b/oldnewthing/archive/2011/12/06/10244432.aspx 请参阅此博客文章: http : //blogs.msdn.com/b/oldnewthing/archive/2011/12/06/10244432.aspx
This link showing how Chrome picks the dominant color may also be helpful. 此链接显示了Chrome如何选择主要颜色。 http://www.quora.com/Google-Chrome/How-does-Chrome-pick-the-color-for-the-stripes-on-the-Most-visited-page-thumbnails http://www.quora.com/Google-Chrome/How-does-Chrome-pick-the-color-for-the-stripes-on-the-Most-visited-page-thumbnails
Find this snippet for android 查找适用于Android的代码段
http://forums.makingmoneywithandroid.com/android-development/406-%5Bhow-%5D-get-average-color-drawable-bitmap.html http://forums.makingmoneywithandroid.com/android-development/406-%5Bhow-%5D-get-average-color-drawable-bitmap.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.