android - ViewPager+FragmentPagerAdapter app running slow with one fragment having GridView -
In my view, the ViewPager contains three pieces of ViewPager. I and Gridview for each grid containing images for a grid I am using (6 images). When I make changes with the plane text with gridview and slice, swipe is actually very slow.
I started Gridview and Layout Inflator, which is responding to Slag. Should I use the FragmentStatePagerAdapter ? But the number of pieces I'm using is only 3. How do I make smooth transitions between different tabs?
Code for slice class with gridview
Push the mainTourism section {@Override Public View onCreateView (LayoutInflater inflater, ViewGroup container, bundle) SavedInstanceState) {// TODO Automatic Created Method Stub ViewGroup rootView = (ViewGroup) inflater.inflate (R.layout.fragment_tourism, faucet) extends; Gridview Gridview = (Gridview) Routeview.FindvibIID (RIDGDView); Gridview.setAdapter (new tourism image adapter (getActivity ()); Return root view; }}
Code for adapter class
Public class TourismImageAdapter extends BaseAdapter {Personal Integer [] mThumbIds = {R. Drawable .a, r.drawable.b, R.drawable.c, R.drawable.d}; Private reference mContext; Public Tourism Image Adapter (Reference C) {mContext = c; } @ Override Public Inaccount () {// Todo auto generated method stub returns mThumbIds.length; } @OverWide Public Object Hot Itam {// To-O Auto-Generated Method Stub Return Null; } @ Override Public Long ITMID (Int Position) {// Tudo Auto-Generated Method Stub Return 0; } @ Override public view getView (int position, seeviewview, ViewGroup parents) {// TODO auto generated method stub image view image; If (convertView == null) {// If it has not been recycled, start some features like imageView = New ImageView (mContext); ImageView.setLayoutParams (new GridView.LayoutParams (150, 150)); ImageView.setScaleType (ImageView.ScaleType.CENTER_CROP); ImageView.setPadding (8, 8, 8, 8); } And {imageView = (ImageView) ConvertView; } ImageView.setImageResource (mTHhumbIds [status]); See return image; }}
Comments
Post a Comment