badgeview 和 radiobutton结合使用导致点击无响应解决办法
如果不添加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();
相关推荐
huha 2020-10-16
xfcyhades 2020-11-20
sgafdsg 2020-11-04
Michael 2020-11-03
fengyeezju 2020-10-14
ziyexiaoxiao 2020-10-14
业余架构师 2020-10-09
OuNuo0 2020-09-29
moses 2020-09-22
Angelia 2020-09-11
qinxu 2020-09-10
刘炳昭 2020-09-10
Nostalgiachild 2020-09-07
Nostalgiachild 2020-08-17
leavesC 2020-08-14
一青年 2020-08-13
AndroidAiStudy 2020-08-07
ydc0 2020-07-30
绿豆饼 2020-07-28