2013-07-18 63 views
2

我有問題,網格顏色覆蓋不僅主要內容,而且菜單。Android導航抽屜 - 菜單上的網格顏色

這是我的佈局:

<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<!-- The main content view --> 
<FrameLayout 
    android:id="@+id/content_frame" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 
<!-- The navigation drawer --> 
<FrameLayout android:id="@+id/left_drawer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="start"/> 
</android.support.v4.widget.DrawerLayout> 

初始化代碼:

public class Launch extends SherlockFragmentActivity { 

private ActionBarDrawerToggle mDrawerToggle; 
private DrawerLayout mDrawerLayout; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_launch); 

    // menu fragment 
    ListFragment menu = new com.sayler.inz.Menu(); 
    FragmentManager fm = getSupportFragmentManager(); 
    fm.beginTransaction().replace(R.id.left_drawer, menu).commit(); 



    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, 
      GravityCompat.START); 
    mDrawerLayout.setScrimColor(Color.GREEN); 

屏幕: 由於沒有棉麻織物的顏色和綠色: http://www.sarigato.com/android/no_color.png http://www.sarigato.com/android/green.png

回答

4

我想這是因爲你的left_drawer沒有背景:

<!-- The navigation drawer --> 
<FrameLayout android:id="@+id/left_drawer" 
android:layout_width="match_parent" 
android:background="#efefef" 
android:layout_height="match_parent" 
android:layout_gravity="start"/> 
+0

現在它工作。謝謝 – czajna666