0

IM試圖讓輸出FRM一個異步類,並在網格視圖使用側的片段 我敢肯定,我的輸入是正確的網適配器不工作

public void processFinish(movieList output) { 
     String[] movieId=output.getMovieId(); 
     String[] movieImg=output.getMovieId(); 
     boolean response=output.getStatus(); 
     if(response==true){ 
      GridView gridView = (GridView) view.findViewById(R.id.gridView_cover); 
      MovieAdapter = new movieGridAdapter(getActivity(), movieImg); 
      gridView.setAdapter(MovieAdapter); 
} 

GridAdapter

public View getView(int position, View view, ViewGroup viewGroup) { 
     ImageView imageView; 
     if(view==null){ 
      imageView= new ImageView(mContext); 
      // imageView.setLayoutParams(new GridView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); 
      imageView.setScaleType(ImageView.ScaleType.FIT_XY); 

     } 
     else 
     { 
      imageView=(ImageView) view; 

     } 

     Picasso.with(mContext).load(image_base_url+imgs[position]).into(imageView); 
     //Log.v(movieGridAdapter.class.getSimpleName(),"http://image.tmdb.org/t/p/w500/"+imgs[position]); 

     return imageView; 
    } 

回答

0
if(view==null){ 
      view = inflater.inflate(R.layout.YOUR_ADAPTER_LAYOUT, null); 
      imageView= new ImageView(mContext); 
      // imageView.setLayoutParams(new GridView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); 
      imageView.setScaleType(ImageView.ScaleType.FIT_XY); 
    } 

你沒有爲你的gridview充氣佈局,因此你什麼也看不見!