The combination of badgeview and radiobutton results in unresponsive click solutions

If you don't add a badgeview, there is no problem with clicking. If you add it, it is not easy to click.

You can add transparent buttons

For details, please refer to

<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>

     <!-- For realizing reminder information -->
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:orientation="horizontal"
                android:background="#00000000"
               
                >
                 <!-- The button android:layout_weight=1 that displays the reminder information is 3 buttons, which equally divide the width of the mobile interface-->
               <Button
                   android:id="@+id/bt"
                   android:layout_height="fill_parent"
                   android:layout_width="0dp"
                   android:layout_weight="1"
                   android:background="#00000000"
                   />
                   <!-- A button that occupies a position to adapt to different resolution mobile phones -->
                   <Button
                       android:visibility="invisible"
                   android:layout_height="fill_parent"
                   android:layout_width="0dp"
                   android:layout_weight="1"
                   />
                   <!-- A button that occupies a position to adapt to different resolution mobile phones -->
                   <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>

 Then use the button in the code

Button btn=(Button)findViewById(R.id.bt);
		BadgeView	  badge4 = new BadgeView(this, btn);
	    badge4.setText("...");
	    badge4.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
	    badge4.show();

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326766965&siteId=291194637