如何做到在RadioGroup 中的 RadioButton右上角 多加一个数字提醒!

楠小小 2013-11-19 07:53:33
请问一下如何做到在RadioGroup 中的 RadioButton右上角 多加一个数字提醒呢?类似微信的底部导航一样。
最好能有例子。网络上的和我这个相差太大了,修改的时候也很复杂!谢谢了啊

<RadioGroup
android:id="@+id/tab_radiogroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center_vertical"
android:orientation="horizontal" >

<RadioButton
android:id="@+id/fragment_radio1"
style="@style/tab_style"
android:layout_marginTop="2.0dip"
android:drawableTop="@xml/main_tabbar1"
android:text="@string/str_tab_title_home" />

<RadioButton
android:id="@+id/fragment_radio2"
style="@style/tab_style"
android:layout_marginTop="2.0dip"
android:drawableTop="@xml/main_tabbar2"
android:text="@string/str_tab_title_chat" >
</RadioButton>

<RadioButton
android:id="@+id/fragment_radio3"
style="@style/tab_style"
android:layout_marginTop="2.0dip"
android:drawableTop="@xml/main_tabbar3"
android:text="@string/str_tab_title_contacts" />

<RadioButton
android:id="@+id/fragment_radio4"
style="@style/tab_style"
android:layout_marginTop="2.0dip"
android:drawableTop="@xml/main_tabbar4"
android:text="@string/str_tab_title_friend" />

<RadioButton
android:id="@+id/fragment_radio5"
style="@style/tab_style"
android:layout_marginTop="2.0dip"
android:drawableTop="@xml/main_tabbar5"
android:text="@string/str_tab_title_setting" />
</RadioGroup>



private void change_Fragment() {

F_RadioGroup = (RadioGroup) findViewById(R.id.tab_radiogroup);
F_RadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO 自动生成的方法存根
transaction = fragmentManager
.beginTransaction();
switch (checkedId) {
case R.id.fragment_radio1:
Log.v(TAG, "点击第1个");
if (null == FragmentHome) {
FragmentHome = new Fragment_Home();

}

transaction.replace(R.id.Main_content, FragmentHome);
transaction.addToBackStack(null);
transaction.commit();
break;
case R.id.fragment_radio2:
Log.v(TAG, "点击第2个");
if (null == FragmentChat) {
FragmentChat = new Fragment_Chat();
}
transaction.replace(R.id.Main_content, FragmentChat);
transaction.addToBackStack(null);
transaction.commit();
break;

我目前的代码是这样子的!
...全文
234 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wbq501 2015-05-14
  • 打赏
  • 举报
回复
http://blog.csdn.net/hhhccckkk/article/details/16981561 android:focusable="false" android:visibility="invisible" 记得加这两个属性在button里面
wbq501 2015-05-14
  • 打赏
  • 举报
回复
http://blog.csdn.net/hhhccckkk/article/details/16981561
盛夏的剩下 2015-01-05
  • 打赏
  • 举报
回复
楼主解决没有!

80,360

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧