2016-12-22 3 views
0

私はAndroidアプリを開発中です。私のアプリでは、材料引き出し-を使用して、引き出しを左側に設定しています。私は引き出しを簡単にセットアップできます。しかしそれは問題を抱えている。以下のスクリーンショットのようなシステムウインドウに常に収まります。画面は常にAndroidのシステムWindowsに適合素材引き出し

enter image description here

これは私が活動に引き出しを設定する方法です。

private void setUpLeftDrawer() 
    { 
     DrawerBuilder builder = new DrawerBuilder() 
       .withActivity(this) 
       .withToolbar(toolbar); 
     if(areas!=null && areas.size()>0) 
     { 

      for(Area area: areas) 
      { 
       PrimaryDrawerItem item = new PrimaryDrawerItem().withIdentifier(area.getId()).withName(area.getName()); 
       builder.addDrawerItems(item); 
      } 
     } 

     builder.build(); 
    } 

これは私のmain_activity xmlです。

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:fitsSystemWindows="false" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <!-- This LinearLayout represents the contents of the screen --> 


     <!-- The ActionBar displayed at the top --> 
     <android.support.design.widget.AppBarLayout 
      android:id="@+id/appbar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
      <android.support.v7.widget.Toolbar 
       android:fitsSystemWindows="false" 
       android:id="@+id/toolbar" 
       android:minHeight="?attr/actionBarSize" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:titleTextColor="@android:color/white" 
       > 
      </android.support.v7.widget.Toolbar> 
     </android.support.design.widget.AppBarLayout> 

     <!-- The main content view where fragments are loaded --> 


</RelativeLayout> 

だから、私はそれがシステムWindowsに合うようにしたくありません。私のコードをシステムウインドウに合わせないように修正するにはどうすればいいですか?

私は、それは同様に機能していない

<item name="android:fitsSystemWindows">false</item> 

だけでなく、スタイルXMLでこれを設定してみました。

+0

<item name="android:windowTranslucentStatus">true</item> を削除<項目名= "アンドロイド:fitsSystemWindows">真 –

+0

を私はシステムWindows @DushyantSutharにフィットするようにしたくありません。私はxmlスタイルのテーマで修正しようとしました。しかし、それは私が問題に言及したように機能していません。 –

+0

あなたはすでに問題を解決しましたか?なぜfitsSystemWindows = trueを使用したくないのですか?あなたはサンプルを見たことがありますか? – mikepenz

答えて

0

値-V21のスタイルから

<!-- 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> 
     <item name="android:windowTranslucentStatus">true</item><!--this--> 
    </style> 
+0

その行は私のスタイルテーマに含まれていません。値はありません.21も同様です。 –

+0

はプログラムで設定しましたか? –

+0

はい私はなぜそれを見つけましたか?私は、非同期http要求を作成し、コールバックでそれを設定しています。私は非同期http呼び出しの前にそれを設定して、コールバックの項目を追加しようとしました。それは正常に働いた。私はちょうど数分前にこの問題を解決しました。私を助けてくれてありがとう。 –

関連する問題