How to increase the size of the actionButton icon in a SherlockActionBar?

To define an 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> 



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

enter image description here

Here is the icon:

enter image description here

+1
android actionbarsherlock icons
Apr 29 '13 at 8:18
source share
2 answers

First of all, I suggest you try the different sizes of the icon you want, without scrolling, until you reach your goal. If this does not suit you, you can add a custom view to the action bar and set OnClickListener to the button and achieve your goal. Here's how to do it:

 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); 

That should do the trick. To achieve this, you can use Button or ImageButton.

+2
Apr 29 '13 at 8:28
source share

Use transparent, high resolution, non-indented PNG images. Follow the rules for creating icons . You can also use the action bar and the Icon Generator tab to create icons that match your recommendations.

+2
Apr 29 '13 at 8:22
source share



All Articles