改变Android中menu菜单的背景色
(2011-07-16 21:20:06)protected void setMenuBackGround() { getLayoutInflater().setFactory( new android.view.LayoutInflater.Factory() {
@Override public View onCreateView(String name, Context context, AttributeSet attrs) { // TODO Auto-generated method stub // 指定自定义inflater的对象 if (name .equalsIgnoreCase("com.android.internal.view.menu.IconMenuItemView")) { try { LayoutInflater inflater = getLayoutInflater(); final View view = inflater.createView(name, null, attrs); new Handler().post(new Runnable() { public void run() { view .setBackgroundResource(R.drawable.application_background_static); } }); return view; } catch (InflateException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } return null; } }); }