如何增加actionButton的图示尺寸以SherlockActionBar? [英] How to increase icon size of actionButton in SherlockActionBar?

查看:154
本文介绍了如何增加actionButton的图示尺寸以SherlockActionBar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要定义actionButton并设置它的图标,我会:

To define the actionButton and set its icon, I would:

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/m_login"
        android:enabled="true"
        android:showAsAction="always"
        android:icon="@drawable/login"/>
</menu>


所得图标(绘制/ LDPI)看起来很小默认为:(?任何方式增加大小)


The resulted icon(drawable/ldpi) looks very small by default: (Any way to increase the size?)

下面的图标:

推荐答案

所有我建议你尝试用不同大小,你想要的图标,没有任何垫,直到你实现你的目标的首位。如果不适合你,你可以在动作条添加自定义视图,设置 OnClickListener 上一个按钮,实现自己的目标。这里有一个方法如何做到这一点:

First of all I suggest you to try with different sizes of the icon which you want, without no paddings until you achieve your goal. If that not suits you, you can add a custom view in actionbar and set OnClickListener on a button and achieve your goal. Here is a way how to do this :

View customNav = LayoutInflater.from(this).inflate(R.layout.my_button, null); // layout which contains your button.
Button mButton = (Button) customNav.findViewById(R.id.date_num);
mButton.setOnClickListener(this);

getSupportActionBar().setCustomView(customNav);
getSupportActionBar().setDisplayShowCustomEnabled(true);

这是应该做的伎俩。你可以用按钮或ImageButton的实现这一目标。

That should do the trick. You can use Button or ImageButton to achieve this.

这篇关于如何增加actionButton的图示尺寸以SherlockActionBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆