0

ここから参照してTabPageIndicatorください。私のレイアウト XML は次のとおりです。ViewPager

<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 からダウンロードしたサンプルを参照し、ここからカスタム スタイルを参照しました。

今、すべてが正常に動作します。ただし、Tab のタイトルの下部はカバーされています。そして、上に不要なスペースを残します。タブのタイトル全体を表示できません。画面のスクリーンショットを添付しました。

「By Date」と「By Test」というタイトルを少し上に配置してほしい。しかし、解決策を見つけることができませんでした。

ここに画像の説明を入力

4

1 に答える 1

1

あなたのを完全に制御するためにtabPageIndicator

XMLファイルを作成し、その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>

コードからそのレイアウトを膨らませます

于 2013-01-09T11:45:33.210 に答える