简体   繁体   English

造型Sherlock行动吧

[英]Styling Sherlock Action Bar

I'm trying to set an image as background of the Sherlock Action Bar, but even if the it's 720 x 112 px, it seems like the image doesn't stretch. 我正在尝试将图像设置为Sherlock Action Bar的背景,但即使它是720 x 112像素,看起来图像也不会延伸。 The white part is still part of the Action Bar, as the triangle is set in the correct position and the button on the right, has different margins on the top and at the bottom. 白色部分仍然是操作栏的一部分,因为三角形设置在正确的位置,而右侧的按钮在顶部和底部具有不同的边距。

Do I need to make it a 9patch image? 我需要制作9patch图像吗? Not sure why it doesn't work.. 不知道为什么它不起作用..

I'm setting the background with a getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.topbar)); 我用getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.topbar));设置背景getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.topbar));

Thanks a lot in advance for the help! 非常感谢您的帮助!

在此输入图像描述

Did you put your image in hdpi or mdpi? 你把图像放在hdpi或mdpi中了吗? Try switching around. 尝试切换。 Ultimately, use draw-9-patch and safe yourself a lot of headache. 最终,使用draw-9-patch并让自己安然无恙。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM