RadioButton与BadgeView结合使用!
来源:互联网 发布:淘宝二手gopro可信吗 编辑:程序博客网 时间:2024/05/17 21:57
先看效果图:
BadgeView对象可以结合其他控件可以在控件上面显示.具体用法可以自己百度,用起来很简单,我就不做多介绍了。
下面是我主要想表达的:
如果BadgeView与RadioGroup中的RadioButton结合后,RadioButton可以显示提示信息标志,但是就没办法切换界面了,这明显不是我想要的效果
但是前面我用Button来显示提示信息,还是可以点击跳转的,不影响其操作。
就想能不能两者结合起来呢。
答案是可以的。
思路就是把Button显示在RadioButton上面,而Button背景设为透明,这样用户看到的RadioButton。提示信息是捆绑在Button上面的哦,这个要注意。
下面是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"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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"/>
<RadioGroup
android:id="@+id/main_tab"
android:background="@drawable/maintab_toolbar_bg"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="bottom">
<RadioButton
android:layout_marginTop="2.0dip"
android:text="@string/main_home"
android:drawableTop="@drawable/icon_1_n"
android:id="@+id/radio_button0"
style="@style/main_tab_bottom"/>
<RadioButton
android:layout_marginTop="2.0dip"
android:text="@string/main_news"
android:drawableTop="@drawable/icon_2_n"
android:id="@+id/radio_button1"
style="@style/main_tab_bottom"/>
<RadioButton
android:layout_marginTop="2.0dip"
android:text="@string/main_my_info"
android:drawableTop="@drawable/icon_3_n"
android:id="@+id/radio_button2"
style="@style/main_tab_bottom"/>
<RadioButton
android:layout_marginTop="2.0dip"
android:text="@string/menu_search"
android:drawableTop="@drawable/icon_4_n"
android:id="@+id/radio_button3"
style="@style/main_tab_bottom"/>
<RadioButton
android:layout_marginTop="2.0dip"
android:text="@string/more"
android:drawableTop="@drawable/icon_5_n"
android:id="@+id/radio_button4"
style="@style/main_tab_bottom"/>
</RadioGroup>
</LinearLayout>
<!-- 实现提醒信息用的 -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="#00000000"
android:layout_alignParentBottom="true"
>
<Button
android:visibility="invisible"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
<!-- 显示提醒信息的button android:layout_weight=1 是3个button,平分手机界面的宽度-->
<Button
android:id="@+id/bt"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#00000000"
/>
<Button
android:visibility="invisible"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
<Button
android:visibility="invisible"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
<Button
android:visibility="invisible"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
</LinearLayout>
</RelativeLayout>
</TabHost>
主要是这个思路想法很好。
具体可以看:http://blog.csdn.net/hhhccckkk/article/details/16981561
- RadioButton与BadgeView结合使用!
- android 红点BadgeView与RadioButton结合使用的问题
- BadgeView 与 RadioButton
- Android RadioButton BadgeView使用问题
- Fragment与RadioButton结合使用
- Fragment与RadioButton结合使用
- badgeview 和 radiobutton结合使用导致点击无响应解决办法
- BadgeView使用
- ListView与RadioButton的结合单选
- Android RadioButton与BadgeView完美实现红点显示(小技巧)
- 使用RadioGroup与RadioButton
- ListView中item只能选择一项的做法,ListView与radioButton结合使用
- CheckBox与RadioButton的使用
- RadioButton与CheckBox混合使用
- RadioButton与 checkBox的使用
- BadgeView使用介绍
- BadgeView使用介绍
- Android----BadgeView使用介绍
- JavaSe基础XX20——网络编程_2
- Sublime Text 使用介绍、全套快捷键及插件推荐
- Linux笔记(2)
- 深入解析Cookie技术
- [Java][MAT] Shallow Heap大小计算释疑
- RadioButton与BadgeView结合使用!
- LeetCode-Merge Intervals
- 简单易学的技术教程索引
- win7安装了apache后,本机可以访问,局域网其他机器无法访问
- 关于Java多线程和并发运行的学习(五)——同步集合类
- Word里替换网页上粘下来的下箭头为回车符
- Processing是什么?
- 全是经验啊
- PHP 获取当前域名