Simple example of toast custom layout implemented by Android programming
This paper describes the method of realizing toast custom layout by Android programming. Share with you for your reference, as follows:
I wonder if you think the toast information of the system is ugly. It has a black background and no color by default.
Then I'll teach you the simplest way to customize the toast layout.
First load a custom layout
Then find the controls inside, taking the simple textview as an example
Next, set the information for textview
The most important thing is to reference the layout to the toast
Get toast:
Set the display position of toast:
Set the pop-up time:
Set layout:
The last step is to show:
guys! Is it very simple? In the future, you can use the handsome toast information to stay away from the short and poor. This is our goal
For more Android related content, readers who are interested can view the special topics of this site: summary of Android layout skills, introduction and advanced tutorial of Android development, summary of Android debugging skills and solutions to common problems, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of Android basic component usage Android view skills summary and Android control usage summary
I hope this article will help you in Android programming.