List of usage examples for android.view LayoutInflater.Factory LayoutInflater.Factory
LayoutInflater.Factory
From source file:nf.frex.android.FrexActivity.java
static void setMenuBackground(final Activity activity) { activity.getLayoutInflater().setFactory(new LayoutInflater.Factory() { @Override/*w w w .j a v a 2 s . c om*/ public View onCreateView(String name, Context context, AttributeSet attrs) { if (name.equalsIgnoreCase("com.android.internal.view.menu.IconMenuItemView")) { try { LayoutInflater inflater = activity.getLayoutInflater(); final View view = inflater.createView(name, null, attrs); new Handler().post(new Runnable() { public void run() { view.setBackgroundColor(Color.argb(127, 0, 0, 0)); } }); return view; } catch (InflateException e) { // :( } catch (ClassNotFoundException e) { // :( } } return null; } }); }