Android imitates QQ and displays the login status effect in the status bar

Run this example, a user login interface will be displayed. After entering the user name (hpuacm) and password (1111), click login to pop up the list dialog box for selecting login status as shown in the following figure,

Click the list item representing login status, the dialog box disappears, and the notification representing login status is displayed in the upper left corner of the screen (as shown in the figure)

After a period of time, the notification disappears, and the icon representing the login status is displayed on the status bar (as shown in the figure)

Drop down the status bar to see the status details (as shown in the figure)

Click the change login status button to display a list of notifications. Click the exit button to delete the notification.

Specific implementation method:

Here is a login interface RES / layout / main.xml:

The effect is shown in the figure

Write the XML layout file items.xml used to layout the contents of list items. In this file, the horizontal linear layout manager is adopted, and the ImageView component and a textview component are added to the layout manager to display the icons and text in the list items respectively. res/layout/items.xml:

MainActivity:

The running effect is the same as that described at the beginning, and it is successful!

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>