/**android
* 改變menuItem上的文字顏色 ide
*/this
private void getMenuTextColor() {spa
getLayoutInflater().setFactory(new Factory() {get
@Overrideit
public View onCreateView(String name, Context arg1,io
AttributeSet attrs) {view
// TODO Auto-generated method stubvi
// Inflate the menu; this adds items to the action bar if it isco
// present.
if (name.equalsIgnoreCase("com.android.internal.view.menu.IconMenuItemView")
|| name.equalsIgnoreCase("com.android.internal.view.menu.ActionMenuItemView")) {
try {
LayoutInflater f = getLayoutInflater();
final View view = f.createView(name, null, attrs);
if (view instanceof TextView) {
((TextView) view).setTextColor(Color.WHITE);
}
return view;
} catch (InflateException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
return null;
}
});
}