我正在使用TabPageIndicator
与ViewPager
,here引用。我的布局XML如下:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.viewpagerindicator.TabPageIndicator
android:id="@+id/indicator"
android:layout_height="35dp"
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:layout_margin="0dp"
android:background="#69cbd8"
/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
在Manifest
中,活动定义如下:
<activity
android:name=".modules.results.ResultsLauncher"
android:configChanges="orientation|screenSize"
android:theme="@style/StyledIndicators">
>
<!-- android:label="Titles/With Listener" -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.jakewharton.android.viewpagerindicator.sample.SAMPLE" />
</intent-filter>
</activity>
如您所见,我使用了自定义样式StyledIndicators
。我曾经提过过
从GITHUB&amp; amp;引用here的自定义样式。
现在一切正常。但是Tab的标题的底部正在被覆盖。并留下不必要的空间。我无法显示标签的整个标题。我附上了我的屏幕截图。
我希望标题为“By Date”&amp; “通过测试”在上部稍微放置。但是找不到解决方案。
答案 0 :(得分:1)
为了完全控制您的tabPageIndicator
:
创建XML文件并在tabPageIndicator
组件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<include
android:id="@+id/tab_inbox"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
layout="@layout/tab_inbox" />
<include
android:id="@+id/tab_dialer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
layout="@layout/tab_dialer" />
</LinearLayout>
并从代码中扩充该布局