Android的动作条背景图片 [英] Android ActionBar Background Image

查看:130
本文介绍了Android的动作条背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以设置背景图像的动作条,但没有它装配尺寸关闭的形象呢?我想设置背景,以适应图像的动作条大小。我该怎么办呢?

解决方案

 最后的动作条动作条= getActionBar();

 BitmapDrawable背景=新BitmapDrawable(BitmapFactory.de codeResource(getResources()
 R.raw.actionbar_background));

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

 actionBar.setBackgroundDrawable(背景);
 

看到这个

Can I set a background image to the actionbar but without it fitting the size off the image? I want to set the background and to fit the image in the actionbar size. How can I do that?

解决方案

 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);

See this

这篇关于Android的动作条背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆