java.lang.illegalstateexception: a factory has already been set on this layoutinflater

后端 未结 5 613
轻奢々
轻奢々 2020-12-06 11:57

I have tried to change the background color of options menu in my android app. I am using ActionBarSherlock library. I have tried this code for changing the background color

5条回答
  •  醉酒成梦
    2020-12-06 12:09

    This works for me:

    LayoutInflater inflater = LayoutInflater.from(context);
    if (inflater.getFactory() != null) {
        inflater = inflater.cloneInContext(context);
    }
    inflater.setFactory(factory);
    

提交回复
热议问题