Android导航抽屉 - 菜单上的稀松布颜色

时间:2013-07-18 09:36:43

标签: android android-layout

我有稀松布颜色不仅覆盖主要内容而且覆盖菜单的问题。

这是我的布局:

<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

1 个答案:

答案 0 :(得分: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"/>