Android actionBar OnClick()

标签 android background onclick listener android-actionbar

这可能是一个奇怪的问题,但我想要一个处理程序来处理操作栏上的点击,这是因为我使用背景来绘制图标/ 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/

相关文章:

html - 如何在背景图像上方但在 div 内的文本下方添加半透明框?

android - 如何在 Android App 的禁用 EditText 中捕获 onclick 事件

android - 如何以编程方式添加按钮色调

安卓 : Soft Keyboard covering edit text up (adjustresize or adjustpan doesnt work)

android - 强制 webview 显示桌面站点

background - 如何在 <div> 中放置背景图片?

android - 使用 libgdx 连接两个设备

javascript - 将鼠标悬停在提交按钮上时如何更改整个主体背景颜色?

JavaScript 每次点击时增加++ 不透明度

Javascript 更改 TD bgColor onClick