Number of message prompts at the bottom of WeChat for Android

Source: Internet
Author: User


Today, a friend asked me about the implementation of a layout file, that is, the implementation of tabhost with message prompts at the bottom. As a matter of fact, I have long thought about this effect. The original idea was that I would have guessed it was implemented using framelayout. So I will share this achievement with you today. And such applications are very extensive. Well, if there is a picture of the truth, go to the topic.

Effect:

 

Implementation idea:

Don't be surprised. In fact, this is still a tabactivity, but the layout is different. When you see this interface, you will first think of something that represents whether you are proficient in layout, which is very simple, it must be a framelayout cascade that shows the number of the message. Well, if you are smart, you don't need to talk about anything nonsense. In fact, you can understand the layout of files at a glance. Finally, add the source code:

 

<? 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: 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" Android: layout_height = "wrap_content" Android: layout_weight = "0.0" Android: visibility = "gone"/> <linearlayout Android: id = "@ + ID/main_tab_group" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" Android: layout_gravity = "bottom" Android: background = "@ drawable/mmfooter_bg" Android: gravity = "bottom" Android: Orientation = "horizontal" Android: paddingtop = "2.0dip"> <framelayout Android: layout_width = "0.0dip" Android: layout_height = "fill_parent" Android: layout_weight = "1.0" Android: Background = "@ null"> <linearlayout Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: gravity = "bottom | Center"> <radiobutton Android: Id = "@ + ID/tab_home" style = "@ style/mmtabbutton" Android: checked = "true" Android: drawabletop = "@ drawable/tab_weixin" Android: text = ""/> </linearlayout> <linearlayout Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: gravity = "Top | right | Center" Android: paddingright = "10.0dip"> <textview Android: Id = "@ + ID/main_tab_unread_ TV" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: Background = "@ drawable/tab_unread_bg" Android: gravity = "center" Android: text = "2" Android: textcolor = "@ Android: color/White" Android: textsize = "10.0dip" Android: visibility = "visible"/> </linearlayout> </framelayout> <radiobutton Android: id = "@ + ID/tab_second" style = "@ style/mmtabbutton" Android: drawabletop = "@ drawable/tab_address" Android: text = "Address Book"/> <framelayout Android: layout_width = "0.0dip" Android: layout_height = "fill_parent" Android: layout_weight = "1.0" Android: Background = "@ null"> <linearlayout Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: gravity = "bottom | Center"> <radiobutton Android: Id = "@ + ID/main_tab_find_friend" style = "@ style/mmtabbutton" Android: drawabletop = "@ drawable/tab_find_frd" Android: text = ""/> </linearlayout> <linearlayout Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: gravity = "Top | right | Center" Android: paddingright = "10.0dip"> <textview Android: Id = "@ + ID/main_tab_new_ TV" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: Background = "@ drawable/tab_unread_bg" Android: gravity = "center" Android: text = "2" Android: textcolor = "@ Android: color/White "Android: textsize =" 10.0dip "Android: visibility =" invisible "/> </linearlayout> </framelayout> <framelayout Android: layout_width =" 0.0dip "Android: layout_height = "fill_parent" Android: layout_weight = "1.0" Android: Background = "@ null"> <linearlayout Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: gravity = "bottom | Center"> <radiobutton Android: Id = "@ + ID/main_tab_settings" style = "@ style/mmtabbutton" Android: drawabletop = "@ drawable/tab_settings" Android: text = ""/> </linearlayout> <linearlayout Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: gravity = "Top | right | Center" Android: paddingright = "10.0dip"> <textview Android: Id = "@ + ID/main_tab_setting_new_ TV" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: Background = "@ drawable/tab_unread_bg" Android: gravity = "center" Android: paddingleft = "6.0dip" Android: paddingright = "6.0dip" Android: TEXT = "2" Android: textcolor = "@ Android: color/White" Android: textsize = "10.0dip" Android: visibility = "invisible"/> </linearlayout> </framelayout> </linearlayout> </tabhost>

If you need to reprint reference please indicate the source: http://blog.csdn.net/jiahui524

You are welcome to have more exchanges. Sharing is the foundation of happiness! Let's grow together with cainiao!

 

Source code: http://download.csdn.net/detail/jiahui524/4218403

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.