Android仿微信底部菜单栏功能显示未读消息数量仿微信底部菜单栏功能显示未读消息数量
主要介绍了Android仿微信底部菜单栏功能,并显示未读消息数量,具有一定的参考价值,感兴趣的小伙伴们可
以参考一下
底部菜单栏底部菜单栏很重要,我看了一下很多应用软件都是用了底部菜单栏,这里使用了tabhost做了一种通用的(就是可以像微信那
样显示未读消息数量的,虽然之前也做过但是layout下的xml写的太臃肿,这里去掉了很多不必要的层,个人看起来还是不错
的,所以贴出来方便以后使用)。
先看一下做出来之后的效果:
以后使用的时候就可以换成自己项目的图片和字体了,主框架不用变哈哈,
首先是要布局layout下xml文件 main.xml:
<?xml version="1.0" encoding="UTF-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/bg_gray"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:layout_weight="1.0" />
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"