Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void setMenuBackground(){
- getLayoutInflater().setFactory( new Factory() {
- @Override
- public View onCreateView ( String name, Context context, AttributeSet attrs ) {
- if ( name.equalsIgnoreCase( "com.android.internal.view.menu.IconMenuItemView" ) ) {
- try { // Ask our inflater to create the view
- LayoutInflater f = getLayoutInflater();
- final View view = f.createView( name, null, attrs );
- // Kind of apply our own background
- new Handler().post( new Runnable() {
- public void run () {
- view.setBackgroundResource( R.drawable.menu_background);
- }
- } );
- return view;
- }
- catch ( InflateException e ) {
- }
- catch ( ClassNotFoundException e ) {
- }
- }
- return null;
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement