1.xml布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ptas_operation_bottom_bar" android:layout_width="fill_parent" android:layout_height="wrap_content"android:layout_alignParentBottom="true" android:gravity="center_vertical" android:orientation="horizontal" android:paddingLeft="0.6600001dip" android:paddingRight="0.6600001dip"><RadioGroup android:id="@+id/main_radio" style="@style/Ptas_Tab_Radio_Group_Bg" android:layout_gravity="bottom"><RadioButton android:id="@+id/radio_navigation" style="@style/Ptas_Tab_Bottom" android:layout_marginTop="2.0dip" android:text="文字一" /><RadioButton android:id="@+id/radio_vary" style="@style/Ptas_Tab_Bottom" android:layout_marginTop="2.0dip" android:text="文字一" /><RadioButton android:id="@+id/radio_doing" style="@style/Ptas_Tab_Bottom" android:layout_marginTop="2.0dip" android:text="文字一" /><RelativeLayout android:id="@+id/notice_re" style="@style/Ptas_Tab_Bottom_Notice"><RadioButton android:id="@+id/radio_notice" style="@style/Ptas_Tab_Bottom" android:layout_centerInParent="true" android:layout_marginTop="2.0dip" android:text="文字一" /><TextView android:id="@+id/notice_count_text" android:layout_width="28dip" android:layout_height="28dip" android:layout_alignParentRight="true" android:layout_alignParentTop="true"android:background="@drawable/notice_count" android:gravity="center" android:text="0" android:textSize="13dip" android:textStyle="bold" /></RelativeLayout><RadioButton android:id="@+id/radio_setting" style="@style/Ptas_Tab_Bottom" android:layout_marginTop="2.0dip" android:text="文字一" /></RadioGroup></LinearLayout>

2.代码控制切换GroupRadio

private void mainBtnGroupOnclick() {mainBtnGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(RadioGroup group, int checkedId) {if (navigaionBtn.getId() == checkedId) {tabHost.setCurrentTab(1);} else if (varyBtn.getId() == checkedId) {tabHost.setCurrentTab(2);} else if (doingBtn.getId() == checkedId) {tabHost.setCurrentTab(3);} else if (settingBtn.getId() == checkedId) {tabHost.setCurrentTab(5);}if (checkedId != noticeBtn.getId()) {noticeBtn.setChecked(false);noticeBtn.setFocusableInTouchMode(false);}}});navigaionBtn.setOnClickListener(this);varyBtn.setOnClickListener(this);doingBtn.setOnClickListener(this);noticeBtn.setOnClickListener(this);settingBtn.setOnClickListener(this);}@Overridepublic void onClick(View view) {if (view.getId() == noticeBtn.getId()) {noticeBtn.setBackgroundResource(R.drawable.home_btn_bg_d);navigaionBtn.setChecked(false);doingBtn.setChecked(false);varyBtn.setChecked(false);settingBtn.setChecked(false);settingBtn.setFocusableInTouchMode(false);varyBtn.setFocusableInTouchMode(false);doingBtn.setFocusableInTouchMode(false);navigaionBtn.setFocusableInTouchMode(false);tabHost.setCurrentTab(4);} else {noticeBtn.setBackgroundColor(android.R.color.transparent);}}

3.更新数字

Handler myHandler = new Handler() {public void handleMessage(Message msg) {switch (msg.what) {case Main.NOTICE_COUNTER_MESSAGE_WHAT:int counter = msg.getData().getInt("counter", 0);if (counter == 0) {noticeCountText.setVisibility(View.GONE);} else {noticeCountText.setText("" + counter);noticeCountText.setVisibility(View.VISIBLE);}break;}super.handleMessage(msg);}};private void updateNoticeCounter() {new Thread(new Runnable() {@Overridepublic void run() {while (!Thread.currentThread().isInterrupted()) {Message message = new Message();message.what = Main.NOTICE_COUNTER_MESSAGE_WHAT;Bundle data = new Bundle();data.putInt("counter", NoticeHolder.getNoticeInfos().size());message.setData(data);myHandler.sendMessage(message);try {Thread.sleep(100);} catch (InterruptedException e) {Thread.currentThread().interrupt();}}}}).start();}

更多相关文章

  1. 关于文字颜色/图片背景---selector状态列表
  2. android 的C++代码都加 namespace android
  3. Android--通过关键字查找短消息数据库并将匹配的信息显示
  4. [Android] 代码实现按钮/图片自旋转(中心旋转)
  5. android 单元测试
  6. Android的Location功能代码
  7. Android(安卓)framwork 锁屏界面开发 笔记
  8. android studio多渠道号,多包名打包
  9. 页面跳转采用滑动效果

随机推荐

  1. android:exported
  2. android 使用SAX解析xml
  3. android下开源项目
  4. Android文件目录结构
  5. Android导出一个JAR库/Android如何将程序
  6. Android计算器简单逻辑实现
  7. Android(安卓)Studio上非常棒的插件
  8. 【Android】注解框架(二)-- 基础知识(Java注
  9. Android 开源项目-StandupTimer学习笔记
  10. 发掘美丽的 Android 桌面