jpardogo / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
2.19k stars 354 forks source link

No padding around text. #30

Closed StephaneBg closed 9 years ago

StephaneBg commented 9 years ago

There is no padding around text of tabs with version 4.0.4 on a tablet. It works on my Nexus 5 on Lollipop. Here is my XML extract : <com.astuetz.PagerSlidingTabStrip android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:textColor="@color/white" app:pstsIndicatorColor="@color/white" app:pstsTabBackground="?attr/selectableItemBackground"/>

https://github.com/StephaneBg/ScoreItProject/blob/master/ScoreIt/src/main/res/layout-sw600dp/activity_about.xml

screenshot_2014-11-25-18-20-55

screenshot_2014-11-25-18-24-56 1

jpardogo commented 9 years ago

Ok , thanks for reporting the issue. I will take a look. In the meantime you can use pstsTabPaddingLeftRight if you didn't do it yet.

StephaneBg commented 9 years ago

I tried it without success.

Le mar. 25 nov. 2014 19:27, Javier Pardo de Santayana Gómez < notifications@github.com> a écrit :

Ok , thanks for reporting the issue. I will take a look. In the meantime you can use pstsTabPaddingLeftRight if you didn't do it yet.

— Reply to this email directly or view it on GitHub https://github.com/jpardogo/PagerSlidingTabStrip/issues/30#issuecomment-64447190 .

jpardogo commented 9 years ago

Could it be because they are inside a dialog fragment? what the whole xml of this dialog fragment? Could you do more test on this devices and tell me when it happens and when it doesn't? what device is it?

StephaneBg commented 9 years ago

I tried on another tablet and it works fine with the DialogFragment. I think it is specific to this device/platform. I'll try to dig a little more why it happens. Device is an Archos G9 running Android 4.0.4.

Le Tue Nov 25 2014 at 21:59:00, Javier Pardo de Santayana Gómez < notifications@github.com> a écrit :

Could it be because they are inside a dialog fragment? could you do more

test on this devices and tell me when it happen and when it doesn't? what device is it?

— Reply to this email directly or view it on GitHub https://github.com/jpardogo/PagerSlidingTabStrip/issues/30#issuecomment-64469698 .

MizzleDK commented 9 years ago

I'm experiencing this issue on an old Android 4.0.4 device as well:

device-2014-11-27-015059

There's plenty of padding on newer versions of Android. Changing any of the settings doesn't help. If there's a limited number of tabs, however, it seems like it works with the expanded setting:

device-2014-11-27-015229

jpardogo commented 9 years ago

What device?

MizzleDK commented 9 years ago

This is on an old Xperia Neo that I keep around for testing purposes :-)

DavidWiesner commented 9 years ago

same issue in the original library https://github.com/astuetz/PagerSlidingTabStrip/issues/120 Like mentioned in that issue description setting a 9-patch-background to a view will remove the padding. So just reapply the padding of the tab in the updateTabStyles() should solve the problem.

    private void updateTabStyles() {
        for (int i = 0; i < tabCount; i++) {
            View v = tabsContainer.getChildAt(i);
            v.setBackgroundResource(tabBackgroundResId);
+           v.setPadding(tabPadding, v.getPaddingTop(), tabPadding, v.getPaddingBottom());
            TextView tab_title = (TextView) v.findViewById(R.id.tab_title);
MizzleDK commented 9 years ago

Awesome! Seems like an easy fix then.

Can you implement the fix, @jpardogo?

jpardogo commented 9 years ago

I will try to take a look tonight. Did you test it @MizzleDK ? In stead of reapplying the padding I will just apply the padding after the backgroun,I deleting it from here. It should be alright

DavidWiesner commented 9 years ago

I have tested it and it worked on my Galaxy Nexus. Yes you can remove the other line

MizzleDK commented 9 years ago

Yep, that should work! :+1:

MizzleDK commented 9 years ago

Did you manage to take a look at it? :smiley:

jpardogo commented 9 years ago

No sorry, maybe tomorrow.

MizzleDK commented 9 years ago

Awesome! :-) On Dec 6, 2014 6:52 PM, "Javier Pardo de Santayana Gómez" < notifications@github.com> wrote:

No sorry, maybe tomorrow.

— Reply to this email directly or view it on GitHub https://github.com/jpardogo/PagerSlidingTabStrip/issues/30#issuecomment-65907103 .

MizzleDK commented 9 years ago

Just thought I'd mention that the proposed fix does indeed work :-)