[英]Hidden tab headers on Tabbed Activity
作为Android Studio的初学者,我有一个主要活动,该活动带有一个图像按钮,可启动“选项卡式”活动。 我使用添加了一个新活动
右键单击>新建>活动>选项卡式活动
它创建activity_tabbed.xml和fragment_tabbed.xml
fragmented_tabbed.xml内容:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.webraya.t0.t0.Tabbed$PlaceholderFragment">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/a"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
和activity_tabbed.xml包含:
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_height="match_parent"
tools:context="com.webraya.t0.t0.Tabbed" />
当我运行应用程序并触摸imagebutton时,Tabbed活动开始,结果是:
当我从右向左滑动时,似乎我有3个具有相同图片的标签。 我不知道为什么没有选项卡标题,为什么有三个具有相同内容的选项卡,如何创建标题和更改选项卡内容? 我的主题是Theme.AppCombat.Light.DarkActionBar
任何帮助,将不胜感激。
到清单中,将其添加到每个活动中:android:theme =“ @ android:style / Theme.NoTitleBar.Fullscreen”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.