import android.view.View;
import android.widget.TextView;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.InflateException;
import android.util.AttributeSet;


    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
            getLayoutInflater().setFactory(new android.view.LayoutInflater.Factory(){
            public View onCreateView(String name,Context context,AttributeSet attrs){
                Xlog.d(TAG, "Name = " + name);
            //    if(name.equalsIgnoreCase("com.android.internal.view.menu.IconMenuItemView") || name.equalsIgnoreCase("com.android.internal.view.menu.ActionMenuItemView")){
                        try{
                        LayoutInflater inflater = getLayoutInflater();
                        final View view = inflater.createView(name, null, attrs);
                        if(view instanceof TextView){
                                ((TextView)view).setTextColor(Color.RED);
                                 }
                        return view;
                        }  
                        catch(InflateException e){
                            e.printStackTrace();
                            }
                        catch(ClassNotFoundException e){
                            e.printStackTrace();
                          }
             //           }
                 return null;
                }
            });
        menu.add(Menu.NONE, MENU_REVET, 0, R.string.revert).setEnabled(true)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        menu.add(Menu.NONE, MENU_SAVE, 0, R.string.done).setEnabled(true).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        return super.onCreateOptionsMenu(menu);

    }




参考点击打开链接

点击打开链接

更多相关文章

  1. Android 打开TextView中的超链接
  2. Android 格式化超链接
  3. Android 远程链接 daemon not running 解决方法
  4. android知识链接汇总(2)

随机推荐

  1. 获取RadioButton选中的值
  2. [置顶] Android Studio Android SDK Andr
  3. Android Animation(API Guides翻译)
  4. 开机自启动3
  5. android 读取联系人
  6. 2.4.11 网格视图和图像切换器
  7. android编译时添加库第三方库文件
  8. 2.4.10 可展开的列表组件
  9. android 蓝牙
  10. 代码中设置drawableright