Note that there are some explanatory texts on larger screens.

plurals
  1. POTitlePageIndicator: Title text not appearing or hidden on top of activity layout.(Viewpager,Xml)
    text
    copied!<p><strong>ViewPagerFragment.java</strong></p> <pre><code>package nsixty.crew.app; import java.util.List; import java.util.Vector; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import com.viewpagerindicator.TitlePageIndicator; import com.viewpagerindicator.TitleProvider; public class ViewPagerFragment extends FragmentActivity { private CustomFragmentAdapter mPagerAdapter; ViewPager pager; TitlePageIndicator titleIndicator; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.lcmeter); this.initialisePaging(); } private void initialisePaging() { List&lt;Fragment&gt; fragments = new Vector&lt;Fragment&gt;(); fragments .add(Fragment.instantiate(this, LoginActivity.class.getName())); fragments.add(Fragment.instantiate(this, main.class.getName())); this.mPagerAdapter = new CustomFragmentAdapter( super.getSupportFragmentManager(), fragments); pager = (ViewPager) findViewById(R.id.viewpager); pager.setAdapter(this.mPagerAdapter); titleIndicator = (TitlePageIndicator) findViewById(R.id.titles); titleIndicator.setViewPager(pager); } public static class CustomFragmentAdapter extends FragmentPagerAdapter implements TitleProvider { public static final int POSITION_PAGE_1 = 0; public static final int POSITION_PAGE_2 = 1; public static final int POSITION_PAGE_3 = 2; private List&lt;Fragment&gt; fragments; private static final String[] TITLES = new String[] { "LOGIN", "HOME" }; public static final int NUM_TITLES = TITLES.length; @Override public String getTitle(int position) { return TITLES[position]; } public CustomFragmentAdapter(FragmentManager fm, List&lt;Fragment&gt; fragments) { super(fm); this.fragments = fragments; } @Override public int getCount() { // return this.fragments.size(); return NUM_TITLES; } @Override public Fragment getItem(int position) { try { LoginActivity.class.newInstance(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } return this.fragments.get(position); } } } </code></pre> <p><strong>lcmeter.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;com.viewpagerindicator.TitlePageIndicator android:id="@+android:id/titles" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;android.support.v4.view.ViewPager android:id="@+android:id/viewpager" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>AndroidManifest.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="nsixty.crew.app" android:versionCode="1" android:versionName="1.0" &gt; &lt;support-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;application android:icon="@drawable/icon87" android:label="@string/app_name" &gt; &lt;activity android:name="ViewPagerFragment" android:theme="@android:style/Theme.Black.NoTitleBar" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".main" &gt; &lt;intent-filter&gt; &lt;action android:name="nsixty.crew.app.main" /&gt; &lt;category android:name="android.intent.category.DEFAULT" android:screenOrientation="portrait" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".play" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" &gt; &lt;intent-filter&gt; &lt;action android:name="nsixty.crew.app.play" /&gt; &lt;category android:name="android.intent.category.DEFAULT" android:screenOrientation="landscape" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".secondView" android:label="@string/app_name" android:screenOrientation="landscape" &gt; &lt;intent-filter&gt; &lt;action android:name="nsixty.crew.app.SECONDVIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".recorder" android:configChanges="orientation" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" &gt; &lt;intent-filter&gt; &lt;action android:name="nsixty.crew.app.RECORD" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".send" android:label="@string/app_name" &gt; &lt;!-- android:theme="@android:style/Theme.Dialog" --&gt; &lt;intent-filter&gt; &lt;action android:name="nsixty.crew.app.SHARE" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".gallery" android:theme="@android:style/Theme.Dialog" &gt; &lt;intent-filter&gt; &lt;action android:name="nsixty.crew.app.gallery" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".RegisterActivity" android:theme="@android:style/Theme.Dialog" &gt; &lt;/activity&gt; &lt;activity android:name=".media" android:theme="@android:style/Theme.Dialog" &gt; &lt;intent-filter&gt; &lt;action android:name="nsixty.crew.app.media" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".LoginActivity" &gt; &lt;/activity&gt; &lt;activity android:name="CustomTitleBar" &gt; &lt;/activity&gt; &lt;/application&gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;uses-permission android:name="android.permission.WRITE_SETTINGS" &gt; &lt;/uses-permission&gt; &lt;uses-permission android:name="android.permission.CAMERA" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt; &lt;uses-feature android:name="android.hardware.camera" /&gt; &lt;/manifest&gt; </code></pre> <p><strong>ScreenShot1</strong> <img src="https://i.stack.imgur.com/Mtddf.png" alt="LoginActivity activity"></p> <p><strong>ScreenShot2</strong> <img src="https://i.stack.imgur.com/zJGvP.png" alt="Sliding to main activity"></p> <p>Please help me with these tiny problem i just can't figure out where the problem is coming from, i have been working for these for hours. i think the problem will be coming from the Xml layout thanks. </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