Note that there are some explanatory texts on larger screens.

plurals
  1. PODefault Style Fails for ViewPagerIndicator's TabPageIndicator. Why and How to Fix?
    text
    copied!<p>Instead of explaining the issue, much easier if I just show you:</p> <p><img src="https://i.stack.imgur.com/i4apZ.png" alt="Unstyled Tab Titles"></p> <p>As you can see the tab titles are all mashed together and entirely unstyled. They function correctly in that swiping through switches tabs (though there's no visible indication except position shifting where appropriate) and tapping a tab switches the view, but all style is missing. Here is the code:</p> <p>gallerylists.xml</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;com.viewpagerindicator.TabPageIndicator android:id="@+id/indicator" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;android.support.v4.view.ViewPager android:id="@+id/gallerypager" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>GalleryLists.java</p> <pre class="lang-java prettyprint-override"><code>public class GalleryLists extends Activity { Context context; private static final String[] titles = new String[] { "20 Hottest", "20 Worst", "20 Awesomest", "MMA", "Comedy", "Moto", "Games" }; ViewPager listPager; ListPagerAdapter listPagerAdapter; PageIndicator indicator; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallerylists); context = this; listPagerAdapter = new ListPagerAdapter(); ViewPager.OnPageChangeListener changeListener = new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i1) {} @Override public void onPageSelected(int i) {} @Override public void onPageScrollStateChanged(int i) {} }; listPager = (ViewPager) findViewById(R.id.gallerypager); listPager.setAdapter(listPagerAdapter); listPager.setOnPageChangeListener(changeListener); indicator = (TabPageIndicator) findViewById(R.id.indicator); indicator.setViewPager(listPager); indicator.setOnPageChangeListener(changeListener); } private class ListPagerAdapter extends PagerAdapter { // Not important (I believe) } } </code></pre> <p>That's it. Now, unless I'm very confused despite reading the documentation and examining the samples, I shouldn't have to take any extra steps to use the default style. I'm at a bit of a loss.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload