2016-08-30 7 views
1

도구 모음이 정상을 만드는 방법도구 모음

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

을 이동 위로 이동?

투명 툴바 만드는 법? 난 당신이 android:fitsSystemWindows="true"을 설정하기 때문입니다

<?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

하면 전체 화면 테마를 사용할 수 있습니다 : 당신의 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; } 

아래와 같은 방법을 만듭니다. –

+0

@ 서랍을 사용하는 경우 왜 레이아웃에 'DrawerLayout'이 정의되어 있습니까? – mikepenz

답변

0

activity_main.xml 마이크 펜즈 및 탭 으로 서랍을 사용합니다.

android : 상태 표시 줄과 같은 시스템 창을 기반으로보기 레이아웃을 조정하는 fitsSystemWindows 특성입니다. true의 경우,이 뷰의 패딩을 조정 해, 시스템 윈도우의 스페이스를 남겨 둡니다. 이보기가 포함되지 않은 활동에있는 경우에만 적용됩니다.

어느 쪽이든 당신은 당신은 그것을 두 가지 방법으로 할 수있는이 줄을 제거하거나 거짓

+0

작동하지 않음, 윈도우 false –

+0

systemWindow와 관련하여 프로그래밍 방식으로 어떤 것을 제공 했습니까? –

1

으로 설정할 수 있습니다.

먼저 xml : AppBar에서 다른 API 수준에 맞게 다른 치수를 설정하고 패딩을 설정할 수 있습니다.

둘째 자바 기준 :

set this padding on your Appbar. 
+0

작동하지 않음, .... –