1

I have created a simple options menu. For some odd reason the scroll bar shows up as belowenter image description here

How can I get rid of this ?

The size of the icons are 48*48. If I decrease the size to 44*44 it solves the problem. But I want a 48*48 icon because it shows up big and is easy to see.

Code for building menu

  @Override  
  public boolean onCreateOptionsMenu(Menu menu) {  

    menu.add("Settings").setIcon(R.drawable.gear);  
    menu.add("User").setIcon(R.drawable.user).;  
    return super.onCreateOptionsMenu(menu); 
  } 

Thanks for your time and input.

1
  • 1
    This one is not sure.But have u tried using android's default menu item. android.R.drawable.ic_menu_preferences for settings. If the scrollbar comes still then there is a problem with the menu item. Else I would guess it is the problem with the image chosen for the particular device resolution like mdpi -> 48 * 48, Hdpi 72 * 72 etc. Just a thought.
    – san
    Jan 4, 2012 at 8:05

2 Answers 2

1

this is because you set fixed menu height through menu.xml or through java code . set is as wrap_content .

1
  • I've not added any code in the XML. I am building it through JAVA code. How can I set the height through code ? I've updated the question with some code. Could you suggest me a solution.
    – Vinoth
    Jan 4, 2012 at 7:45
0

I had a similar problem.

After adding divider height to the theme, scroll bar appear in the options menu.

styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
    <item name="android:dividerHeight">@dimen/list_view_divider_height</item> <!--0.5dp-->
    ...
</style>

scroll bar in the options menu

I hope this helps someone else to solve the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.