如果不添加badgeview 点击是没有问题,如果添加了就点击不好使
可以添加透明得button
具体可以参考
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radio0"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:checked="true"
android:drawableBottom="@drawable/tab"
android:gravity="center"
android:tag="0"
android:text="AA"
android:textColor="@color/tab_color" />
<RadioButton
android:id="@+id/radio1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:drawableBottom="@drawable/tab"
android:gravity="center"
android:tag="1"
android:text="BB"
android:textColor="@color/tab_color" />
<RadioButton
android:id="@+id/radio2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:drawableBottom="@drawable/tab"
android:gravity="center"
android:tag="2"
android:text="CC"
android:textColor="@color/tab_color" />
</RadioGroup>
<!-- 实现提醒信息用的 -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="#00000000"
>
<!-- 显示提醒信息的button android:layout_weight=1 是3个butto,平分手机界面的宽度-->
<Button
android:id="@+id/bt"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#00000000"
/>
<!-- 占位置的button,以便适应不同分辨率手机 -->
<Button
android:visibility="invisible"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
<!-- 占位置的button,以便适应不同分辨率手机 -->
<Button
android:visibility="invisible"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_below="@+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>
</RelativeLayout>
然后代码中使用button
Button btn=(Button)findViewById(R.id.bt);
BadgeView badge4 = new BadgeView(this, btn);
badge4.setText("...");
badge4.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
badge4.show();