Eclipse will not recognize project as library (ActionBarSherlock/ViewPagerIndicator)

Where to store the actual library project does not matter, as long as you use a relative link to reference it. Check out the Library Projects – Development considerations: Library project storage location There are no specific requirements on where you should store a library project, relative to a dependent application project, as long as … Read more

ViewPager in ScrollView

I ran into a similar problem in the past. A View-Pager must have a set height (it cannot wrap-content). Since a ViewPager loads separate pages, and not all at once, it won’t know what ‘wrap-content’ actually means. Setting the layout_height to fill_parent or a set dp allows the ViewPager to statically set it’s height and … Read more

Replace fragment with another fragment inside ViewPager

Try using FragmentStatePagerAdapter http://android-developers.blogspot.com/2011_08_01_archive.html coz it will remove the fragment as you swipe through the view(also when you call getitem), so you don’t need to explicitly remove them yourself. I’ve been having the same problem it works for me. I try your code and remove the if (fragment!=null) block and it works.

How to customize individual tabs? (changing background color, indicator color and text color)

Just set your custom view at the tab creation time, something like: final Tab firstTab = actionBar.newTab() .setText(mAppSectionsPagerAdapter.getPageTitle(0)) .setCustomView(R.id.custom_tab_view_red); final Tab secondTab = actionBar.newTab() .setText(mAppSectionsPagerAdapter.getPageTitle(1)) .setCustomView(R.id.custom_tab_view_blue); // etc actionBar.addTab(firstTab); actionBar.addTab(secondTab); // etc in inCreate(). You’ll also have to define Views corresponding to the above ids in your xml layout file (and not styles). Or, if … Read more

android center align the selected tab in tablayout

I took a look into TabLayout and tabContentStart only sets padding for its first child -> SlidingTabStrip, so I set it manually on both sides: public class CenteringTabLayout extends TabLayout { public CenteringTabLayout(Context context) { super(context); } public CenteringTabLayout(Context context, AttributeSet attrs) { super(context, attrs); } public CenteringTabLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, … Read more

Different tab width for TabLayout

You need to lower the weight of the LinearLayout of the corresponding tab. LinearLayout layout = ((LinearLayout) ((LinearLayout) tabLayout.getChildAt(0)).getChildAt(YOUR_TAB_NUMBER)); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) layout.getLayoutParams(); layoutParams.weight = YOUR_WEIGHT; // e.g. 0.5f layout.setLayoutParams(layoutParams); Hope that helps!