Android ActionBar背景图像

Android ActionBar背景图像,android,android-actionbar,background-image,image-size,Android,Android Actionbar,Background Image,Image Size,我是否可以将背景图像设置为actionbar,但不使其与图像大小相匹配?我想设置背景并使图像符合操作栏的大小。我该怎么做 final ActionBar actionBar = getActionBar(); BitmapDrawable background = new BitmapDrawable (BitmapFactory.decodeResource(getResources(), R.raw.actionbar_background)); background.

我是否可以将背景图像设置为actionbar,但不使其与图像大小相匹配?我想设置背景并使图像符合操作栏的大小。我该怎么做

 final ActionBar actionBar = getActionBar(); 

 BitmapDrawable background = new BitmapDrawable (BitmapFactory.decodeResource(getResources(),   
 R.raw.actionbar_background)); 

 background.setTileModeX(android.graphics.Shader.TileMode.REPEAT); 

 actionBar.setBackgroundDrawable(background);

您尝试过什么吗?如果是,请发布代码详细检查:new BitmapDrawable BitmapFactory.DecodeSourceGetResources,R.raw.actionbar\u background;不赞成