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
I faced the same issue but no answer helped me.
In my case:
I'm extending AppCompatActivity
Project targeting API 27
Implementation support lib 27.1.1
Solution: Apparently, now there is no need of setting the Factory to the LayoutInflater, it would crash or be ignored. Just override both methods onCreateView(...) in your AppCompatActivity (from android.support.v4.app.BaseFragmentActivityApi14)
public class myActivity extends AppCompatActivity {
...
@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
if (name.compareTo("EditText") == 0) {
CustomEdit newEdit = new CustomEdit(this,attrs);
return newEdit;
}
return super.onCreateView(parent, name, context, attrs);
}
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
return onCreateView(null, name, context, attrs);
}
...
}