本文实例讲述了Android编程实现的简易路径导航条功能。分享给大家供大家参考,具体如下:
这里要实现的是如图所示的路径导航条,类似于文件管理器的效果。
<强>该导航条包含三个功能:强>
代码很简单,已封装成自定义的观点,如下:
PathTextView.Java
/* * *显示路径的观点,支持返回上一级,支持点击某个位置回到指定层级。 */公开课PathTextView LinearLayout{延伸 私人TextView mTextView; 私人HorizontalScrollView hsView; 私人> & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比; & lt; HorizontalScrollView xmlns: android=" http://schemas.android.com/apk/res/android " android: id=癅 + id/path_hs” android: layout_width=" match_parent " android: layout_height=" wrap_content " android:背景=" @color/light_gray2” android:滚动条="没有"比; & lt; TextView android: id=癅 + id/path_tv” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android:背景=" @color/light_gray2” android: paddingBottom=" 12 dp " android: paddingLeft=" 8 dp " android: paddingRight=" 8 dp " android: paddingTop=" 12 dp " android: textSize=" 15 sp”/比; & lt;/HorizontalScrollView> >之前使用方法也很简单:
更多关于Android相关内容感兴趣的读者可查看本站专题:《Android基本组件用法总结》,《Android视图视图技巧总结》,《Android布局布局技巧总结》,《Android资源操作技巧汇总》、《Android文件操作技巧汇总》、《Android开发入门与进阶教程》、《Android编程之活动操作技巧总结》及《安卓控件用法总结》
希望本文所述对大家Android程序设计有所帮助。
Android编程实现的简易路径导航条功能示例