0

I do not know about the menu text color change. it is default white . and i am trying to change in RED. this is my code:-

 MenuInflater menuInflater = getMenuInflater();
            menuInflater.inflate(R.layout.menu, menu);
            getLayoutInflater().setFactory(new Factory() {
                 public View onCreateView(String name, Context context,
                AttributeSet attrs) {

                if (name     .equalsIgnoreCase("com.android.internal.view.menu.IconMenuItemView")) {
                try {
                LayoutInflater f = getLayoutInflater();
                final View view = f.createView(name, null, attrs);

                new Handler().post(new Runnable() {
                public void run() {

                // set the background drawable
            //  view     .setBackgroundResource(R.drawable.my_ac_menu_background);

                // set the text color
                ((TextView) view).setTextColor(Color.RED);
                }
                });
                return view;
                } catch (InflateException e) {
                } catch (ClassNotFoundException e) {
                }
                }
                return null;
                }


                });
                return super.onCreateOptionsMenu(menu);

but this is not working . FACTORY IS return NULL value.

please any one look .

thank you

Rahul Rawat
  • 999
  • 2
  • 17
  • 40
  • I've never done like that before but here a suggestion, why not just create a style? On this site: http://jgilfelt.github.com/android-actionbarstylegenerator/ you can just tell the colors and download a .zip with the whole style ready for you. MUCH easier! – Budius Mar 05 '13 at 09:53
  • Have your read this question http://stackoverflow.com/questions/10394016/how-can-i-change-the-options-menu-background-for-android-2-3 ? – Yahor10 Mar 05 '13 at 10:04
  • yes i have done all this . but not got good solution plz tell other thank – Rahul Rawat Mar 05 '13 at 10:08
  • @budius i dont want to use . there is not text change – Rahul Rawat Mar 05 '13 at 10:10
  • oh yeah, I just realised now the auto-generated one doesn't change the text. But you can still use styles to change it. Just not the auto-generated one. – Budius Mar 05 '13 at 10:12

0 Answers0