Android材质设计导航抽屉菜单图标更改

Android材质设计导航抽屉菜单图标更改,android,android-actionbar,android-actionbar-compat,Android,Android Actionbar,Android Actionbar Compat,我使用示例实现了一个材料设计nav抽屉。我根据我的主题定制它。一切都很顺利。这是我最不想定制的菜单图标。我用谷歌搜索了一下,但没有找到任何好的解决办法。我想改变它的颜色,如果可能的话,或添加一个自定义绘图。任何想法的解决方案。提前谢谢 这是我在menifest中设置的应用程序主题 <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> <item name

我使用示例实现了一个材料设计nav抽屉。我根据我的主题定制它。一切都很顺利。这是我最不想定制的菜单图标。我用谷歌搜索了一下,但没有找到任何好的解决办法。我想改变它的颜色,如果可能的话,或添加一个自定义绘图。任何想法的解决方案。提前谢谢

这是我在menifest中设置的应用程序主题

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:textColorPrimary">@color/textColorPrimary</item>
        <item name="android:windowBackground">@color/windowBackground</item>

    </style>
加:


对于您的
活动
onCreate

我自己找到了解决方案。这确实很容易。您所要做的就是设置工具栏样式。在您的样式中,主颜色用作工具栏标题,文本主颜色用作菜单图标颜色

    style name="GalaxyZooThemeToolbarDarkOverflow" parent="Theme.AppCompat.NoActionBar">
           <item name="android:textColorPrimary">@color/headerColor</item>
    <item name="android:iconPreview">@drawable/ic_launcher</item>

<item name="actionMenuTextColor">@color/colorPrimaryDark</item>
<item name="android:textColorSecondary">@color/headerColor</item>
style name=“GalaxyZooThemeToolbarDarkOverflow”parent=“Theme.AppCompat.NoActionBar”>
@颜色/头颜色
@牵引式/集成电路发射器
@颜色/原色暗
@颜色/头颜色

很抱歉我的绘画技巧:p因此,一定有别的事情出错了,因为你就是这样做的。发布您的
活动
style.xml
blipinsk。现在请查收。
public class Activity_Home extends ActionBarActivity implements FragmentDrawer.FragmentDrawerListener {

    private static String TAG = Activity_Home.class.getSimpleName();

    private Toolbar mToolbar;
    private FragmentDrawer drawerFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_drawer);

        mToolbar = (Toolbar) findViewById(R.id.toolbar);

        setSupportActionBar(mToolbar);
        getSupportActionBar().setDisplayShowHomeEnabled(true);


        drawerFragment = (FragmentDrawer)
                getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
        drawerFragment.setUp(R.id.fragment_navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), mToolbar);
        drawerFragment.setDrawerListener(this);

        // display the first navigation drawer view on app launch
        displayView(0);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity__main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }
//
//      if(id == R.id.action_search){
//          Toast.makeText(getApplicationContext(), "Search action is selected!", Toast.LENGTH_SHORT).show();
//          return true;
//      }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onDrawerItemSelected(View view, int position) {
        displayView(position);
    }

    private void displayView(int position) {

    }
}
getSupportActionBar().setHomeAsUpIndicator(resId);
getSupportActionBar().setHomeAsUpIndicator(drawable);
    style name="GalaxyZooThemeToolbarDarkOverflow" parent="Theme.AppCompat.NoActionBar">
           <item name="android:textColorPrimary">@color/headerColor</item>
    <item name="android:iconPreview">@drawable/ic_launcher</item>

<item name="actionMenuTextColor">@color/colorPrimaryDark</item>
<item name="android:textColorSecondary">@color/headerColor</item>