2016-08-30 8 views
1

ツールバーは正常にする方法ツールバー

http://i.stack.imgur.com/QCXYs.png

を上に移動上に移動しましたか?

透明ツールバーの作成方法は?

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


<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/main_activity_DrawerLayout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:context=".MainActivity"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
     android:background="?attr/colorPrimary" /> 

    <su.gamepoint.opendomofon.pro.sliding.SlidingTabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:elevation="2dp" 
     android:background="@color/ColorPrimary" /> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:layout_weight="1"> 
    </android.support.v4.view.ViewPager> 

</LinearLayout> 
</android.support.v4.widget.DrawerLayout> 
+0

を使用すると、フルスクリーンのテーマを使用するかもしれません。 –

+0

@АндрейУжеговあなたが私の引き出しを使用している場合、なぜあなたのレイアウトに 'DrawerLayout'が定義されていますか? – mikepenz

答えて

0

私はあなたがandroid:fitsSystemWindows="true"を設定するためですマイクペンツ、タブによって引き出しを使用しています。

アンドロイド:ステータスバーなどのシステムウィンドウに基づいてビューレイアウトを調整するfitsSystemWindows属性。 trueの場合、このビューのパディングを調整して、システムウィンドウのスペースを確保します。このビューが埋め込みされていないアクティビティにある場合にのみ有効です。

どちらか、あなたはそれを2つの方法で行うことができ、この行を削除するか、または虚偽の

+0

作業していない、ウィンドウfalse –

+0

systemWindowに関してプログラム的に何かを与えましたか? –

1

に設定することができます。

まずはxmlAppBarで異なるAPIレベルに異なるディメンションを設定し、埋め込みを設定できます。 JAVAによる第二

:あなたのonCreate()で、その後

public int getStatusBarHeight() { 
    int result = 0; 
    int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); 
    if (resourceId > 0) { 
     result = getResources().getDimensionPixelSize(resourceId); 
    } 
    return result; 
} 

以下のようなメソッドを作成します。

set this padding on your Appbar. 
+0

作業していない、.... –