2017-05-07 4 views
0

내 앱에서 URL에서 이미지 (16 이미지)를로드하지만 이미지가 GridView에로드 된 후 스크롤이 원활하지 않습니다.GridView - 스크롤링이 부드럽 지 않다

android:fastScrollEnabled="true"
android:smoothScrollbar="true"

을하지만 아무것도 여전히 원활하지 스크롤을 발생하지 : 일부 장치에서 이것이 내가 이해하지 못했다 일, 난 글라이드 도서관 난 이미 시도 사용을 사용하고 있습니다.

@Override 
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { 
    final ArrayList<String> movieList = new ArrayList<>(); 
    /*Source*/ 
    movieList.add("https://i.imgur.com/KAoAPcY.jpg"); 
    ...... 
    /*****/ 
    View v = inflater.inflate(R.layout.fragment_art, container, false); 
    myGrid = (GridView) v.findViewById(R.id.gridViewCategory); 
    myGrid.setFastScrollEnabled(true); 
    adapter = new CategoryAdapter(getActivity(), movieList); 
    myGrid.setAdapter(adapter); 
    myGrid.setSmoothScrollbarEnabled(true); 
    myGrid.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { 
     @Override 
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 
        Intent popup = new Intent(getActivity(), Pop.class); 
        popup.putExtra("WallpaperURL", movieList.get(position)); 
        startActivity(popup); 
     } 
     }); 
     return v; 
    } 
} 
    class CategoryAdapter extends BaseAdapter { 
    private Context context; 
    private ArrayList<String> imageId= new ArrayList<>(); 
    CategoryAdapter(Context context,ArrayList<String> imageId){ 
     this.context=context; 
     this.imageId=imageId; 
} 
@Override 
public int getCount() { 
    return imageId.size(); 
} 

@Override 
public Object getItem(int position) { 
    return imageId.get(position); 
} 

@Override 
public long getItemId(int position) { 
    return position; 
} 
private class ViewHolder{ 
    ImageView CategoryImage; 
    ViewHolder(View view){ 
     CategoryImage = (ImageView) view.findViewById(R.id.cat_imageView); 
    } 
} 
@Override 
public View getView(int position, View convertView, ViewGroup parent) { 
    //View row = convertView; 
    ViewHolder holder; 
    convertView = null; 
    if(convertView == null){ 
     LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     convertView = inflater.inflate(R.layout.picture_item, parent, false); 
     holder = new ViewHolder(convertView); 
     convertView.setTag(holder); 
     final ProgressBar progressBar = (ProgressBar) convertView.findViewById(R.id.progress); 
     Glide.with(context) 
       .load(imageId.get(position)) 
       .listener(new RequestListener<String, GlideDrawable>() { 
        @Override 
        public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { 
         progressBar.setVisibility(View.GONE); 
         return false; 
        } 
        @Override 
        public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { 
         progressBar.setVisibility(View.GONE); 
         return false; 
        } 
       }) 
       .into(holder.CategoryImage); 
    } 
    else{ 
     holder = (ViewHolder) convertView.getTag(); 
    } 
    return convertView ; 
} 

답변

0

내 manifest.xml에 android:hardwareAccelerated="true"을 추가했습니다.