Android programming implementation of custom title function example

This article describes the example of Android programming to realize the custom title function. Share with you for your reference, as follows:

Here I added a logo in front, and changed the background and height of the title.

First, write the layout file of title, title.xml:

Then add these three sentences to oncreate() of activity:

It should be noted that the order of these three sentences cannot be changed. Here, I just changed the layout of the title. Next, I changed the background and height, which requires changing the theme of the activity.

Create a new file style.xml in the values folder:

Finally, add the following to androidmanifest.xml:

This implements the custom title.

For more Android related content, readers who are interested can view the topics on this site: introduction and advanced tutorial of Android development, summary of Android debugging skills and common problem solutions, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of Android basic component usage, summary of Android view skills Android layout skills summary and Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>