这可能是一个奇怪的问题,但我想要一个处理程序来处理操作栏上的点击,这是因为我使用背景来绘制图标/ Logo 组合,因为当我使用内置方法时它不适合.
这会导致没有图标或 Logo ,您可以单击这些图标或 Logo 以转到主 Activity ,而当您单击操作栏时我想要这样。
我尝试了很多方法,使 Logo /图标不可见以及其他方法,但我不知道如何让它工作。有任何想法吗?
操作栏看起来像这样:
final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
Bitmap bm = UnscaledBitmapLoader.loadFromResource(getResources(), R.drawable.logo, null);
BitmapDrawable background = new BitmapDrawable(this.getResources(), bm);
background.setTileModeX(android.graphics.Shader.TileMode.CLAMP);
actionBar.setBackgroundDrawable(background);
位图加载器不会做任何特殊的事情来阻止它。如何获得操作栏的 onclick 监听器?
最佳答案
How to I get a onclick listener for the actionbar?
不支持,抱歉。
This because I use a background to draw the Icon/logo combination because it doesn't fit right when I use the build in methods.
它适用于其他所有人。也许您应该考虑就此主题提出关于 SO 的不同问题,并使用屏幕截图来说明您的问题。
关于Android actionBar OnClick(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10496793/