Simple path navigation bar function example implemented by Android programming

This paper describes the simple path navigation bar function realized by Android programming. Share with you for your reference, as follows:

What we want to achieve here is the path navigation bar as shown in the figure, which is similar to the effect of file manager.

The navigation bar contains three functions:

1. Support adding any sub path (slide left and right when a line of text cannot be written); 2. Support returning to the previous path; 3. Click a path in the middle to return to the specified location.

The code is very simple and has been encapsulated into a custom view, as follows:

PathTextView.Java

The layout file is actually a textview:

simple_ tv.xml

The method of use is also simple:

1. During initialization, call the initroot (string text) method to pass in the root path name; 2. When clicking a list item to enter the next level, call the append (long ID, string text) method to pass the ID (for uniqueness) and name of the current item; 3. When returning to the previous level, call the backparent() method; 4. When clicking an intermediate path, the onitemclicklistener.onclick (long currentid, int backcount) method will be called back and return the ID of the clicked item and the number of levels returned.

For more Android related content, readers who are interested can view the topics on this site: summary of Android basic component usage, summary of Android view skills, summary of Android layout skills, summary of Android resource operation skills, summary of Android file operation skills, introduction and advanced tutorial of Android development Activity operation skills summary of Android programming 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
分享
二维码
< <上一篇
下一篇>>