【问题标题】:how to change the icon on action bar in android如何在android中更改操作栏上的图标
【发布时间】:2015-06-29 06:01:12
【问题描述】:

我创建了一个滑动菜单,我想使用 (...) 打开它,但我尝试了很多更改图标 (

 mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                    R.drawable.ic_drawer1, //nav menu toggle icon
                    R.string.app_name, // nav drawer open - description for accessibility
                    R.string.app_name // nav drawer close - description for accessibility
            ) {
                public void onDrawerClosed(View view) {
                    getActionBar().setTitle("hello");
                    // calling onPrepareOptionsMenu() to show action bar icons
                    invalidateOptionsMenu();
                }

                public void onDrawerOpened(View drawerView) {
                    getActionBar().setTitle("ohhh");
                    // calling onPrepareOptionsMenu() to hide action bar icons
                    invalidateOptionsMenu();
                }
            };

         //   getSupportActionBar().setDisplayShowHomeEnabled(true);

       //     getActionBar().setHomeButtonEnabled(true);
            //getSupportActionBar().setIcon(R.drawable.ic_drawer1);

          getSupportActionBar().setIcon(R.drawable.ic_drawer1);
            getSupportActionBar().setDisplayUseLogoEnabled(true);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);

【问题讨论】:

    标签: android-actionbar


    【解决方案1】:

    已经问过了。尝试更改清单文件以更改您的应用程序徽标,或者如果它不起作用,请尝试此链接。 Android: How to change the ActionBar "Home" Icon to be something other than the app icon?。这可能会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多