FragmentPagerAdapterでViewPagerを使用しているときに、アクティビティに2つのツールバーが表示されるのはなぜですか?

知恵

ここに画像の説明を入力してくださいフラグメントを表示するアクティビティでViewPagerを作成したいと思います。ただし、カスタムツールバーも表示したいと思います。しかし、私には2つのツールバーとViewPagerがあります。1つはカスタムツールバーで、もう1つはデフォルトのツールバーです。このandroid:theme = "@ style /AppTheme.NoActionBar"のようなテーマを宣言しました

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.2">
    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/toolbarP015"
        android:background="@color/colorOfToolbar"/>
</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.8"
    android:id="@+id/viewPagerP015">

    <android.support.v4.view.PagerTabStrip
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_gravity="top" />

</android.support.v4.view.ViewPager>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<?xml version="1.0" encoding="utf-8"?>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".P000Menu"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name=".P001CoordinatorLayout"
        android:theme="@style/AppTheme.NoActionBar"
        android:parentActivityName=".P000Menu">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".P000Menu">
        </meta-data>
    </activity>

    <activity android:name=".P002FragmentReview"/>

    <activity android:name=".P003TwoFragmentCommunication"/>

    <activity android:name=".P004FragmentProgrammatically"/>

    <activity android:name=".P005FragmentProg2"/>

    <activity android:name=".P006Fragmentv4"/>

    <activity android:name=".P007Fonts"/>

    <activity android:name=".P008HATAScrollingMagic"
        android:theme="@style/AppTheme.NoActionBar"/>

    <activity android:name=".P009DrawerLayoutNew"/>

    <activity android:name=".P010DrawerLayoutFull"
        android:theme="@style/AppTheme.NoActionBar"/>

    <activity android:name=".P011LayoutProgrammatically"/>

    <activity android:name=".P012TabHostReview"/>

    <activity android:name=".P013TabHostNew"/>

    <activity android:name=".P014ViewPagerTransforms"
        android:theme="@style/AppTheme.NoActionBar"/>

    <activity android:name=".P015ViewPagerPagerTabStrip"
        android:theme="@style/AppTheme.NoActionBar"/>
</application>

Dieter_h

次のように変更しますAppBarLayout

   <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbarP015"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#6712FF" />
    </android.support.design.widget.AppBarLayout>

またはAppBarLayout残して削除Toolbarます。

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Related 関連記事

ホットタグ

アーカイブ