Я создал скользящую вкладку с помощью PagerSlidingTabStrip. она создана правильно, но панель действий теряться она показывает, как это:Панель действий, не показывающая с помощью PagerSlidingTabStrip
ли какая-либо помочь мне в этом, почему бар действие отключено.
import com.astuetz.PagerSlidingTabStrip;
public class SMainTabActivity extends FragmentActivity implements ETabFragment.OnFragmentInteractionListener,
MTabFragment.OnFragmentInteractionListener{
public String classSelected;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
setProgressBarIndeterminateVisibility(false);
setContentView(R.layout.activity_subject_main_tab);
Bundle b = getIntent().getExtras();
classSelected = b.getString("classId");
// Get the ViewPager and set it's PagerAdapter so that it can display items
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
viewPager.setAdapter(new TabFragmentPagerAdapter(getSupportFragmentManager()));
// Give the PagerSlidingTabStrip the ViewPager
PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
// Attach the view pager to the tab strip
tabsStrip.setViewPager(viewPager);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.activity_main_actionsbar, menu);
return super.onCreateOptionsMenu(menu);
// getMenuInflater().inflate(R.menu.activity_main_actionsbar, menu);
//return true;
}
XML (activity_subject_main_tab):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
app:pstsShouldExpand="true"
app:pstsTextAllCaps="true"
android:layout_width="match_parent"
android:layout_height="48dp"
android:textSize="14sp"
android:textColor="#000000"
app:pstsDividerColor="@color/color1"
app:pstsIndicatorColor="@color/color2"
app:pstsUnderlineColor="@color/color3"
app:pstsTabPaddingLeftRight="14dp">
</com.astuetz.PagerSlidingTabStrip>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white" />
манифеста:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SubjectMainTabActivity"
android:label="@string/title_activity_subject_main_tab" >
</activity>
</application>
Ожидаемое я s:
Опубликовать R.layout.activity_subject_main_tab и код манифеста –
Можете ли вы опубликовать activity_subject_main_tab.xml? – Hindol
Я добавил xml – itin