在ImageView中将视频显示为BackGround

时间:2014-07-06 19:41:37

标签: android imageview

我试图在我的ListAdapter中加载ImageView的视频inBackground,这里是代码:

                Bitmap thumbnail =    
 ThumbnailUtils.createVideoThumbnail(file2.getAbsolutepath)
 ,MediaStore.Images.Thumbnails.MINI_KIND);

 BitmapDrawable bitmapDrawable = new 
 BitmapDrawable(mContext.getResources(),thumbnail);
        holder.PvideoView.setBackgroundDrawable(bitmapDrawable);
        Picasso.with(mContext).load(R.drawable.autumn_view).resize(PViewWidth,  
 PViewHeight).centerInside().into(holder.PvideoView);

但它返回此异常:

  07-06 11:28:34.380: E/AndroidRuntime(6872): Process: com.lifemate.lmmessenger, 

  07-06 11:28:34.380: E/AndroidRuntime(6872): 
 java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
 07-06 11:28:34.380: E/AndroidRuntime(6872):    at 
 android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:6724)
 07-06 11:28:34.380: E/AndroidRuntime(6872):    at 
 android.widget.ListView.layoutChildren(ListView.java:1589)
 07-06 11:28:34.380: E/AndroidRuntime(6872):    at 
 android.widget.AbsListView.onLayout(AbsListView.java:2091)
 07-06 11:28:34.380: E/AndroidRuntime(6872):    at 
 android.view.View.layout(View.java:14817)
 07-06 11:28:34.380: E/AndroidRuntime(6872):    at 
 android.view.ViewGroup.layout(ViewGroup.java:4631)
 07-06 11:28:34.380: E/AndroidRuntime(6872):    at  
 android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)

我做错了什么?

我也知道这个方法已被删除,即使用API​​ 11,它在API 11中是否有任何替代?

 holder.PvideoView.setBackgroundDrawable(bitmapDrawable);

0 个答案:

没有答案