GithubHelp home page GithubHelp logo

pagerslidingtabstrip's People

Contributors

antoniolg avatar astuetz avatar guillermolechuga avatar henriquerocha avatar shusshu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pagerslidingtabstrip's Issues

black line while sliding

captura de pantalla de 2013-06-21 18 37 52

Hi, im using your library that it is really nice but a black line while sliding pages appears and I don't know how to remove it. I took a look to your code but i have not found what it could be. Is it a bug?

Thanks in advance.

Weird behaviour of NavigationDrawer and ActionBar

If you use the NavigationDrawerFragment from Android you get a weird behaviour after expanding the Drawer.

Somehow there is only the first color of the TransitionDrawable shown, when the Menu of the NavigationDrawer inflates:

TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, ld });
getSupportActionBar().setBackgroundDrawable(td);
td.startTransition(200);

You can see the problem in the following picture:
problem

If I disable the onCreateOptionMenu-Method on the NavigationDrawerFragment the problem is gone...

some users on 2.2 get a NullPointerException, but I haven't been able to replicate the issue on an emulator...

java.lang.NullPointerException
at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:298)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1921)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
at dalvik.system.NativeStart.main(Native Method)

I don't have a tabhost on my layout... just a pagerslidingtabstrip....

is this a known issue?

Gravity

Would it be possible to add Gravity to the component so if we have fewer tabs we can decide to center them

page some times show empty

hi
i have problem by this library please help me! i have a grid view what update it from web by AsyncTask when page changed. my problem is first page is show empty and when click on tabs 2 on show view but if click on tab 3 when tab 1 has selected (move two tab form selected tab) page also is empty. only if swipe one by one page or click on next tab (move one tab form selected tab) it not problem.

problem in summary: sometime page is empty. what is in my code wrong.
sample app with library work correctly but it change view on create view but my code grid view update in AsyncTask by change page selected.

​please help me.I am in a hurry​

my code:

public class SubCategoryActivity extends SherlockFragmentActivity {
static SubCategoryObjectsFragment f;

private PagerSlidingTabStrip tabs;
private ViewPager pager;
private MyPagerAdapter pagerAdapter;
TextView tvCustomTitle;
static List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
static JSONArray jsonArray;
static String url = "http://192.168.1.2/arel/SubCat.php";
static String url2 = "http://192.168.1.2/arel/subCatObject.php";

private static String[][] SubCat;
GridviewAdapter gridAdapter;
static GridView gridViewSubCategory;
HashMap<String, String> map;
static ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
Intent intent;

private class getSubCategoryObjects extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... url) {
        // TODO Auto-generated method stub
        return BaseActivity.jsonParser.makeHttpRequest(url[0], "POST",
                nameValuePairs);

    }

    @Override
    protected void onProgressUpdate(Void... values) {
        // TODO Auto-generated method stub
        super.onProgressUpdate(values);
    }

    @Override
    protected void onPostExecute(String result) {
        // TODO Auto-generated method stub
        try {
            jsonArray = new JSONArray(result);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        for (int i = 0; i < jsonArray.length(); i++) {

            JSONObject jsonObjet;
            map = new HashMap<String, String>();
            try {

                jsonObjet = jsonArray.getJSONObject(i);
                map.put("id", String.valueOf(jsonObjet.getInt("id")));
                map.put("title", jsonObjet.getString("title_fa"));
                map.put("image", jsonObjet.getString("image"));
                map.put("price", jsonObjet.getString("price"));
                map.put("date", jsonObjet.getString("date"));

                list.add(map);

            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (Exception e) {
                // TODO: handle exception
                e.toString();

            }

        }

        // prepared arraylist and passed it to the Adapter class
        gridAdapter = new GridviewAdapter(SubCategoryActivity.this, list);


        gridViewSubCategory.setAdapter(gridAdapter);





    }
}

private class getSubCategory extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... url) {
        // TODO Auto-generated method stub
        return BaseActivity.jsonParser.makeHttpRequest(url[0], "POST",
                nameValuePairs);

    }

    @Override
    protected void onProgressUpdate(Void... values) {
        // TODO Auto-generated method stub
        super.onProgressUpdate(values);
    }

    @Override
    protected void onPostExecute(String result) {
        // TODO Auto-generated method stub
        try {
            jsonArray = new JSONArray(result);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        SubCat = new String[jsonArray.length()][2];
        for (int i = 0; i < jsonArray.length(); i++) {

            JSONObject jsonObjet;

            try {

                jsonObjet = jsonArray.getJSONObject(i);
                SubCat[i][0] = String.valueOf(jsonObjet.getInt("id"));
                SubCat[i][1] = jsonObjet.getString("title_fa");

            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (Exception e) {
                // TODO: handle exception
                e.toString();

            }

        }

        pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());

        pager.setAdapter(pagerAdapter);

// pager.setCurrentItem(0);
//pager.setOffscreenPageLimit(0);

        tabs.setOnPageChangeListener(new OnPageChangeListener() {

            @Override
            public void onPageSelected(int arg0) {
                // TODO Auto-generated method stub
                jsonArray = new JSONArray();
                list = new ArrayList<HashMap<String, String>>();
                nameValuePairs = new ArrayList<NameValuePair>();
                nameValuePairs.add(new BasicNameValuePair("getAdvertise", "true"));
                nameValuePairs.add(new BasicNameValuePair("subCatId",
                        SubCat[arg0][0]));

                // Activity myActivity = getActivity();
                // if (myActivity instanceof SubCategoryActivity) {
                new getSubCategoryObjects().execute(url2);


            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onPageScrollStateChanged(int arg0) {
                // TODO Auto-generated method stub

            }
        });

        //jsonArray = new JSONArray();


        // final int pageMargin = (int) TypedValue.applyDimension(
        // TypedValue.COMPLEX_UNIT_DIP, 16, getResources()
        // .getDisplayMetrics());
        // pager.setPageMargin(pageMargin);

        tabs.setViewPager(pager);
        tabs.setTextSize(20);
        tabs.setTypeface(BaseActivity.font, Typeface.NORMAL);

    //  list = new ArrayList<HashMap<String, String>>();
    //  nameValuePairs = new ArrayList<NameValuePair>();
    //  nameValuePairs.add(new BasicNameValuePair("getAdvertise", "true"));
    //  nameValuePairs.add(new BasicNameValuePair("subCatId",
    //          SubCat[0][0]));

        //new getSubCategoryObjects().execute(url2);

    }
}

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    intent = getIntent();

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    pager = (ViewPager) findViewById(R.id.pager);

    jsonArray = new JSONArray();
    nameValuePairs = new ArrayList<NameValuePair>();
    nameValuePairs.add(new BasicNameValuePair("getSubCategory", "true"));
    nameValuePairs.add(new BasicNameValuePair("catId", intent
            .getStringExtra("id")));

    new getSubCategory().execute(url);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayShowCustomEnabled(true);

    tvCustomTitle = new TextView(this);
    tvCustomTitle.setText(intent.getStringExtra("title"));
    LinearLayout ll = new LinearLayout(this);
    LinearLayout.LayoutParams para = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    para.setMargins(0, 0, 0, 0); // left,top,right, bottom
    para.gravity = Gravity.CENTER_VERTICAL;
    tvCustomTitle.setTypeface(BaseActivity.font);
    Configuration config = getResources().getConfiguration();
    if (Build.VERSION.SDK_INT >= 13) {

        if (config.smallestScreenWidthDp >= 600) {
            tvCustomTitle.setTextSize(22);
        } else {
            tvCustomTitle.setTextSize(14);
        }
    } else {
        tvCustomTitle.setTextSize(14);
    }

    tvCustomTitle.setTextColor(Color.WHITE);
    ll.addView(tvCustomTitle, para);
    getSupportActionBar().setCustomView(ll);

    changeColor(intent.getIntExtra("color", Color.parseColor("#FF666666")));


}

private void changeColor(int newColor) {

    tabs.setIndicatorColor(newColor);

    // change ActionBar color just if an ActionBar is available

    Drawable colorDrawable = new ColorDrawable(newColor);
    Drawable bottomDrawable = getResources().getDrawable(
            R.drawable.actionbar_bottom);
    LayerDrawable ld = new LayerDrawable(new Drawable[] { colorDrawable,
            bottomDrawable });

    getSupportActionBar().setBackgroundDrawable(ld);

}

/*
 * @Override protected void onSaveInstanceState(Bundle outState) {
 * super.onSaveInstanceState(outState);
 * 
 * }
 * 
 * @Override protected void onRestoreInstanceState(Bundle
 * savedInstanceState) { super.onRestoreInstanceState(savedInstanceState);
 * 
 * }
 */
public static class MyPagerAdapter extends FragmentStatePagerAdapter  {

    public MyPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return SubCat[position][1];
    }

    @Override
    public int getCount() {
        return SubCat.length;
    }

    @Override
    public Fragment getItem(int position) {
        f = new SubCategoryObjectsFragment();
        Bundle b = new Bundle();
        b.putString(SubCategoryObjectsFragment.ARG_ID, SubCat[position][0]);
        f.setArguments(b);

        return f;
    }




}

public static class SubCategoryObjectsFragment extends Fragment {

    private static final String ARG_ID = "id";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        View rootView = inflater.inflate(
                R.layout.fragment_sub_category_objects, container, false);

// gridViewSubCategory = new GridView(getActivity());

            gridViewSubCategory = (GridView) rootView.findViewById(R.id.gridViewSubCategory);

        return rootView;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);

        /*
         * jsonArray = new JSONArray(); list = new ArrayList<HashMap<String,
         * String>>(); nameValuePairs = new ArrayList<NameValuePair>();
         * nameValuePairs.add(new BasicNameValuePair("getAdvertise",
         * "true")); nameValuePairs.add(new BasicNameValuePair("subCatId",
         * getArguments().getString("id")));
         * 
         * 
         * Activity myActivity = getActivity(); if (myActivity instanceof
         * SubCategoryActivity) { ((SubCategoryActivity) myActivity).new
         * getSubCategoryObjects().execute(url2); }
         */
        // Implement On Item click listener
        gridViewSubCategory
                .setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent,
                            View view, int position, long id) {
                        // TODO Auto-generated method stub
                        BaseActivity.cd = new ConnectionDetector(
                                getActivity());
                        BaseActivity.isInternetPresent = BaseActivity.cd
                                .isConnectingToInternet();

                        if (BaseActivity.isInternetPresent) {

                            Intent i = new Intent(getActivity(),
                                    SubCategoryActivity.class);
                            i.putExtra("id", ((TextView) view
                                    .findViewById(R.id.textViewId))
                                    .getText().toString());
                            i.putExtra(
                                    "color",
                                    i.getIntExtra("color",
                                            Color.parseColor("#FF666666")));
                            startActivity(i);
                        } else {
                            Toast.makeText(
                                    getActivity(),
                                    "به اينترنت متصل نيستيد، به اينترنت متصل شده و دوباره امتحان کنيد.",
                                    Toast.LENGTH_SHORT).show();
                        }

                    }
                });
    }

}

public class GridviewAdapter extends BaseAdapter {

    private Activity activity;
    private ArrayList<HashMap<String, String>> list;
    HashMap<String, String> tempMap;

    public GridviewAdapter(Activity activity,
            ArrayList<HashMap<String, String>> list) {

        this.activity = activity;
        this.list = list;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub

        LayoutInflater inflator = activity.getLayoutInflater();

        View vi = convertView;
        if (convertView == null)
            vi = inflator.inflate(R.layout.gridview_sub_category_row, null);

        TextView id = (TextView) vi.findViewById(R.id.textViewId);
        TextView title = (TextView) vi.findViewById(R.id.textViewTitle);
        ImageView imageViewSubCat = (ImageView) vi
                .findViewById(R.id.imageViewSubCat);
        TextView price = (TextView) vi.findViewById(R.id.textViewPrice);
        TextView date = (TextView) vi.findViewById(R.id.textViewDate);
        RelativeLayout textBackground = (RelativeLayout) vi
                .findViewById(R.id.relativeLayoutText);

        tempMap = new HashMap<String, String>();
        tempMap = list.get(position);

        id.setText(tempMap.get("id"));
        textBackground.setBackgroundColor(intent.getIntExtra("color",
                Color.parseColor("#FF666666")));
        title.setText(tempMap.get("title"));
        price.setText(tempMap.get("price"));
        date.setText(tempMap.get("date"));
        title.setTypeface(BaseActivity.font);
        price.setTypeface(BaseActivity.font);
        date.setTypeface(BaseActivity.font);

        // File cachedImg = ImageLoader.getInstance().getDiscCache()
        // .get(picUrl + tempMap.get("logo") + ".jpg");

        // if (cachedImg.exists())
        // cachedImg.delete();

        ImageLoader.getInstance().displayImage(
                BaseActivity.picUrl + tempMap.get("image") + ".jpg",
                imageViewSubCat);

        return vi;
    }
}

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    // TODO Auto-generated method stub
    menu.clear();

    menu.add("آگهي جديد").setIcon(R.drawable.action_advertise_new)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    menu.add("غربال").setIcon(R.drawable.action_search)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    menu.add("مرتب سازي").setIcon(R.drawable.action_sort)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    return super.onPrepareOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    if (item.getItemId() == android.R.id.home) {
        finish();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

}

Contribute efforts to the ViewPagerIndicator

Like the TabStrip. Have you considered contributing it to the ViewPagerIndicator project? As you are probably aware it uses the same API as you so it would fit in very naturally.

Pager setCurrentItem for not 0 or last number of item cause indicator error!!!

Add this line => currentPositionOffset = 0f;

    getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        @SuppressWarnings("deprecation")
        @SuppressLint("NewApi")
        @Override
        public void onGlobalLayout() {

            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                getViewTreeObserver().removeGlobalOnLayoutListener(this);
            } else {
                getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }

            currentPosition = pager.getCurrentItem();
            currentPositionOffset = 0f;
            scrollToChild(currentPosition, 0);
        }
    });

Question : MapFragments in the FragmentPagerAdapter supported ?

I was wondering how MapFragments should be handled in the FragmentPagerAdapter ?

If you put a MapFragment in the Pager, how would one make the distinction between

-a horizontal swipe interpreted as a page transition
-a horizontal swipe interpreted as dragging the map

Right now, in order to drag the map I have to drag from right-to-bottom-left in order for the map to drag. A standard drag from right-to-left results in a page transition.

How would you handle that ?

Create Maven repository

Can you please create Maven repository on GitHub or deploy library in Maven Central Repository? It will be very useful for all developers. Many thanks!

Indicator line doesn't stay steady during page scrolling

2014-01-07 13 40 35
2014-01-07 13 40 39

I adjusted the offset of the indicator line to be zero so you can easily see the issue. The left edge of the indicator should be on the edge of the display, but due to rounding, it bounces back and forth a single pixel really fast and is very annoying once you see it.

If you change the lines 333 and 334 in the onDraw() method from

lineLeft = (currentPositionOffset * nextTabLeft + (1f - currentPositionOffset) * lineLeft);
lineRight = (currentPositionOffset * nextTabRight + (1f - currentPositionOffset) * lineRight);

to

lineLeft = (float) Math.floor((currentPositionOffset * nextTabLeft + (1f - currentPositionOffset) * lineLeft));
lineRight = (float) Math.floor((currentPositionOffset * nextTabRight + (1f - currentPositionOffset) * lineRight));

then the issue is mostly fixed. The issue still exists if the math multiplies to be exactly an extra pixel, but it's much less noticeable. The current code is VERY noticeable once you see it.

I've done a Xamarin.Android port of this awesome code

Hi,

Thanks so much for doing the work on this library - I have created a Xamarin.Android port supporting Android 2.2+ over here - https://github.com/LordZoltan/PagerSlidingTabStrip.Net, as it's exactly the kind of thing that I needed for another app I'm working on.

At the time of writing I haven't finished the readme - but it'll be well-attributed to you!

There was also some other cool stuff in your test app that has helped with Android development in general (especially the colour fading action bar - nice touch!).

Cheers

Andras Zoltan (@RealLordZoltan)

NPE if there are no tabs to display

The view throws an exception if there are no tabs available to display. It would be great if the view failed gracefully or gave a better error message.

Test case

mAdapter = new MyFragmentPagerAdapter(getChildFragmentManager());
Assert.assertTrue(mAdapter.size() == 0);
myViewPager.setAdapter(mAdapter);
tabStrip.setViewPager(myViewPager);

Stack trace

java.lang.NullPointerException
        at com.astuetz.PagerSlidingTabStrip$PageListener.onPageScrolled(
                PagerSlidingTabStrip.java:361)
        at android.support.v4.view.ViewPager.onPageScrolled(ViewPager.java:1712)
        at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1633)
        at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:581)
        at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1600)
        ...

Errors when importing

there was around 300 errors when importing to eclipse, it went down to 37 after adding android-support-v4.jar into the libraries external jars.

Any help would be appreciated, just a noob in the learning process.

Crouton notifications overlaps Tab Strips

I tried to use the crouton within PagerSlidingTabStrip but crouton notification shadows the tabstrip, I have to change the crouton notification position, this is not the issue of PagerSlidingTabStrip but scratching my head how can I use the crouton with PagerSlidingTabStrip !

IconTabProvider How can i change icon?

im using this amazing library and now i want to show insted of text and icon and i use IconTabProvider but i want to change the icon depends on what tab is selectd how can i do this ?

Changing the title of the adapter and notifyDatasetChanged does not work.

Hello,

The tabs are great and I really love them.

In my previous implementation using default Pager from Support library, I was able to change the titles dynamically by using:

        titles[0] = myPos;
        mPagerAdapter.notifyDataSetChanged();

The behavior seems broken on your library.

I will try to fix it myself or send you more info/code if needed.

Document is wrong

in the Customization section it:
psts* but it should be set* since it better to set it as command instead edit the library itself

change the fragment when button pressed

Hi , i want to change the fragment when i press button to specific fragment. for example i have 2 fragment A and B in fragment A when i press button it`s go to fragment B , is it possible ? how can i do this ?

can't customize the tabstrip

I get this error message when I try to customize the tab strip:
error: No resource identifier found for attribute 'pstsdividerColor' in package 'com.my.package'

what can I do about that?

setCurrentTab

Ability to set the current tab.

For example I would like to directly see the middle tab

Wrong selected tab when I rotate my nexus 5

I cloned the sample directory from github and I tried the app but I notice the same issue that I had in my app : If I rotate the phone, the selected tabs is shifted on the right. But I don't have this issu on my nexus 7. If someone has an explication.

making tabs fit to screen

On taking only three tabs the tabstrip doesn't fill the full width. Tab size should be allowed to change

Tabs are missing

When i am running the Customized Sample in the device, sometimes i am losing all the tabs but the Scroll on Fragments is working. This type of behavior is observed when app is crashed and it revert backs to a previous Activity, now if i go to the FragmentPager Activity, i am not seeing the tabs !

ViewPager.setCurrentItem() doesn't sync to tab if page is not visible when called

I have an application that has two nested ViewFlippers. Inside the most nested ViewFlipper is a fragment that contains a PagerSlidingTabStrip. In general the strip works fine, but in many cases I want to set the starting tab before the page is visible to the user.

When I call ViewPager.setCurrentItem() and then called the parent ViewFlipper.setDisplayedChild(), the ViewPager shows the right content but the tab strip is not correctly synchronized.

I added "scrollToChild(position, 0);" in "public void onPageSelected(final int position)" inside the PagerSlidingTabStrip's PageListener. This does not fix the problem because the tab container has not yet laid out the children, so the x offset of all the tabs are 0.

I'm not sure how to fix or work around this issue. Any suggestions?

Tab pressed state enhancement suggestion

Hi! First, thanks for this really awesome library; then, I'd like to give you a suggestion to make it even more awesome: at the moment, when the user taps on a tab, it gets a light blue color; however, it's not really consistent with KitKat's grey accents and with the tab's "underline" color (except when it's light blue, obviously); so, could you make the tab assume a gray color on KitKat as play store does, or, even better, the tab's "underline" color, just a little lighter?

Pressed/Selected Tab Colour

Wonderful library, just struggling with one thing. As far as I can see, there's no functionality to change the colour of the tab when it is pressed/selected as it's a light blue in all variants of the demo app. It would be great to be able to set/theme this.

badge numbers

anyway to add badge numbers to these tabs? Is that in the works? Trying to figure that out as we speak.

Title Indicators are not moving

Hi, I found your library example very use full. But when i tried using PagerSlidingTabStrip it does not move as a change Page in ViewPager!.

Here is my xml

       <com.astuetz.viewpager.extensions.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        android:background="@drawable/background_tabs"
        android:visibility="visible" />

     <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/indicator"
        android:layout_below="@+id/tabs"
        android:layout_margin="25dp"
        android:visibility="visible" />

This is my code

 private PagerSlidingTabStrip tabs;
 mPager=(ViewPager)findViewById(R.id.viewPager);
     tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    pages.add("Location");
    pages.add("Register");
    pages.add("Description");
pages.add("Businesshours");
pages.add("Signup");

mPager.setAdapter(adapter);
tabs.setViewPager(mPager);

//Creating Pages with PageAdapter.

     public class PageAdapter extends FragmentStatePagerAdapter
     {
     Context context;
     ArrayList<String> pages;




    public PageAdapter(FragmentManager fm,Context context,ArrayList<String> pages) {
        super(fm);
        // TODO Auto-generated constructor stub
        this.context=context;
        this.pages=pages;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        // TODO Auto-generated method stub
        return pages.get(position);
    }

    @Override
    public Fragment getItem(int position) {
        // TODO Auto-generated method stub
        return new PageFragment(pages.get(position), context);
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return pages.size();
    }



    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        // TODO Auto-generated method stub

        FragmentManager manager = ((Fragment) object).getFragmentManager();
        FragmentTransaction trans = manager.beginTransaction();
        trans.remove((Fragment) object);
        trans.commit();

        super.destroyItem(container, position, object);
    }
}

Actionbar Sherlock

Hi

How can i use this with Actionbar Sherlock?
to work with actionbar on 4- devices

Tab title having both text and icon?

In the notifyDatasetChanged() method of class PagerSlidingTabStrip, I see this code:

for (int i = 0; i < tabCount; i++) {

    if (pager.getAdapter() instanceof IconTabProvider) {
        addIconTab(i, ((IconTabProvider) pager.getAdapter()).getPageIconResId(i));
    } else {
        addTextTab(i, pager.getAdapter().getPageTitle(i).toString());
    }

}

What this leads me to believe is that the tabs can either have a text title, or an icon, but not both. Is this assumption correct? If so, would you consider allowing a tab to have both an icon and a text as a feature request?

List loaded with delay swiping a fragment

Hi,
I'm using a FragmentStatePagerAdapter with PagerSlidingTabStrip to swipe between two SherlockLisFragment attached to a SimpleCursorAdapter with a ViewBinder(). When I swipe from a Fragment A to a Fragment B the list items do not appear until the swipe action is completed. I'm sure it is a problem related to some kind of action listener because this situation does not take place if I use the tabs to switch between the two fragments A and B.
I'll try to fix it by myself but if someone has a suggestions for that it is appreciated!

Library should not enforce targetSdkVersion

Currently the library has targetSdkVersion=19 defined. That means if the consuming app does not use 19 the build will fail. This is a problem when eg. using robolectric which does not yet work with targetSdkVersion 19 but only supports 18. The library can not be used in such a case.

Is this project being maintained?

The owner has not contributed anything on Github for almost 3 months. There are over 40 issues currently open, with only a few with a response from the owner.

I am willing to create and maintain a new active fork of this if he does not respond within the next couple days.

This is an important piece of an application I am writing, so it has been necessary to cherry pick some of the proposed fixes from open PRs. There seems to be a lot of community around this project, but no contributor to merge that work. Let's help each other out and get all these fixes and improvements into a library.

Styling failure with attr pstsTabBackground.

Without pstsTabBackground attr, the styling works fine.
The pstsIndicatorColor,
pstsUnderlineColor and pstsDividerColor not working anymore after add the pstsTabBackground attr.

ENV:
Galaxy S4 GT-I9505
4.3
Support Library v7 ActionBarActivity

SetShouldExpend not working

the method SetShouldExpend(boolean shouldExpend) doesn't work for me.
the only way to change the shouldExpend is the pre-edit the private boolean shouldExpand to true

Right to Left Orentation

Could you please add RTL support? The current solution is to set the current selected tab to the last tab, but the HorizontalScrollView scrolling behavior still doesn't seem right (i.e. The HorizontalScrollView should start scrolling when moving from the most right tab instead from the most left tab).

In other words, if you have 8 tabs and the user moves right from tab 1 to tab 2, then the underline and the HorizontalScrollView both will move. But when moving left from tab 8 to tab 7, then the underline moves to the left but the HorizontalScrollView won't move left (i.e. it doesn't show extra tabs on the left).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.