简体   繁体   English

如何在Android Studio中添加带有图像作为背景的自定义标题栏

[英]How to add a custom title bar with an image as background in android studio

I have found several answers on here as to how to change the background color and add a custom icon to the title bar in android studio but am having difficulties finding an answer for how to use a custom image as the background instead of just a color in the title bar. 我在这里找到了几个有关如何更改背景颜色并将自定义图标添加到android studio中的标题栏的答案,但是我很难找到有关如何将自定义图像用作背景而不是颜色的答案。标题栏。 Any help would be much appreciated. 任何帮助将非常感激。 Thanks. 谢谢。

sadly you cannot add images as the background on both the header and textView/webView that's why you don't see any apps on android with image backgrounds. 遗憾的是,您无法在标题和textView / webView上都添加图像作为背景,这就是为什么您在具有图像背景的android上看不到任何应用程序的原因。 you could try using html instead of xml, like: 您可以尝试使用html而不是xml,例如:

replace colors.xml, styles.xml, ect with colors.html, styles.html, ect 用colors.html,styles.html,ect替换colors.xml,styles.xml,ect

but i doubt that will work. 但我怀疑那行得通。 hopefully they will add this feature later in the android sdk. 希望他们以后会在android sdk中添加此功能。

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

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