Hello,

Trying to create an image view pager like the google play android app. If 
there are portrait or just landscape images it looks all right, but when 
you don;t know what type is it, it looks out of balance. 
<https://lh3.googleusercontent.com/-Oq5TdITdsGw/Uu6YTqE2u-I/AAAAAAAAGWM/VaKMPcybGu0/s1600/rfTvD.png>

I have noticed that changing the pageWidth of the viewPager does this, but 
i don't think it's a correct way of looking at this problem. 
<https://lh3.googleusercontent.com/-Oq5TdITdsGw/Uu6YTqE2u-I/AAAAAAAAGWM/VaKMPcybGu0/s1600/rfTvD.png>

Can anyone give me some hints on how to create this viewpager with remote 
images but not depending on the width and height of the images? I am 
currently using Volley library, which is great!
<https://lh3.googleusercontent.com/-Oq5TdITdsGw/Uu6YTqE2u-I/AAAAAAAAGWM/VaKMPcybGu0/s1600/rfTvD.png>

Thank you.


<https://lh3.googleusercontent.com/-Oq5TdITdsGw/Uu6YTqE2u-I/AAAAAAAAGWM/VaKMPcybGu0/s1600/rfTvD.png>

import java.util.ArrayList;import java.util.List;
import android.support.v4.app.Fragment;import 
android.support.v4.app.FragmentManager;import 
android.support.v4.app.FragmentPagerAdapter;
public class PhotoPagerFragmentAdapter extends FragmentPagerAdapter {

    private List<String> mimages = new ArrayList<String>();
    private int mCount;

    public PhotoPagerFragmentAdapter(FragmentManager fm, List<String> mimages) {
        super(fm);
        this.mimages = mimages;
        mCount = mimages.size();
    }

    @Override
    public Fragment getItem(int position) {
        String imageUrl = mimages.get(position);
        return PhotoDetailsFragment.newInstance(imageUrl);
    }

    @Override
    public int getCount() {
        return mCount;
    }

    @Override
    public float getPageWidth(int position) {
        return (0.8f); // this is what i modify
    }

    public void setCount(int count) {
        if (count > 0 && count <= 10) {
            mCount = count;
            notifyDataSetChanged();
        }
    }}

<https://lh5.googleusercontent.com/-JTdqiQVYYOc/Uu6Ye2Ojt-I/AAAAAAAAGWU/jukxAoebPms/s1600/STN8x.png><https://lh3.googleusercontent.com/-Oq5TdITdsGw/Uu6YTqE2u-I/AAAAAAAAGWM/VaKMPcybGu0/s1600/rfTvD.png>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to