Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:41:19+00:00 2026-06-07T14:41:19+00:00

Is it possible to add radio buttons in gridview ? Or can i make

  • 0

Is it possible to add radio buttons in gridview ? Or can i make checkbox works like a radio button in gridview ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:41:21+00:00Added an answer on June 7, 2026 at 2:41 pm

    Heres an example. Its really possible to just use a radio button. But this is an example that should help. Of course I did not give you EVERYTHING but this should show you it is possible

    import android.content.Context;
    import android.util.AttributeSet;
    import android.util.Log;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.RadioButton;
    import android.widget.TableLayout;
    import android.widget.TableRow;
    
    
    public class ToggleButton extends TableLayout  implements OnClickListener {
    
        private static final String TAG = "ToggleButton";
        private RadioButton activeRadioButton;
    
        /** 
         * @param context
         */
        public ToggleButton(Context context) {
            super(context);
            // TODO Auto-generated constructor stub
        }
    
        /**
         * @param context
         * @param attrs
         */
        public ToggleButton(Context context, AttributeSet attrs) {
            super(context, attrs);
            // TODO Auto-generated constructor stub
        }
    
        @Override
        public void onClick(View v) {
            final RadioButton rb = (RadioButton) v;
            ///////// do whatever /////////////
    
    
        }
    
        /* (non-Javadoc)
         * @see android.widget.TableLayout#addView(android.view.View, int, android.view.ViewGroup.LayoutParams)
         */
        @Override
        public void addView(View child, int index,
                android.view.ViewGroup.LayoutParams params) {
            super.addView(child, index, params);
            setChildrenOnClickListener((TableRow)child);
        }
    
    
        /* (non-Javadoc)
         * @see android.widget.TableLayout#addView(android.view.View, android.view.ViewGroup.LayoutParams)
         */
        @Override
        public void addView(View child, android.view.ViewGroup.LayoutParams params) {
            super.addView(child, params);
            setChildrenOnClickListener((TableRow)child);
        }
    
    
        private void setChildrenOnClickListener(TableRow tr) {
            final int c = tr.getChildCount();
            for (int i=0; i < c; i++) {
                final View v = tr.getChildAt(i);
                if ( v instanceof RadioButton ) {
                    v.setOnClickListener(this);
                }
            }
        }
    
        public int getCheckedRadioButtonId() {
            if ( activeRadioButton != null ) {
                return activeRadioButton.getId();
            }
    
            return -1;
        }
    }
    

    and create a layout like this (of course you need to clean it up but you got the idea)

    <?xml version="1.0" encoding="utf-8"?>
    <com.example.android.view.ToggleButton
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:id="@+id/radGroup1">
        <TableRow>
                <RadioButton android:id="@+id/rad1" android:text="Button1"
                    android:layout_width="105px" android:layout_height="wrap_content"
                    android:textSize="13px" />
                <RadioButton android:id="@+id/rad2" android:text="Button2"
                    android:layout_width="105px" android:textSize="13px"
                    android:layout_height="wrap_content" />
                <RadioButton android:id="@+id/rad3" android:text="Button3"
                    android:layout_width="105px" android:textSize="13px"
                    android:layout_height="wrap_content" />
        </TableRow>
        <TableRow>
                <RadioButton android:id="@+id/rad1" android:text="Button1"
                    android:layout_width="105px" android:layout_height="wrap_content"
                    android:textSize="13px" />
                <RadioButton android:id="@+id/rad2" android:text="Button2"
                    android:layout_width="105px" android:textSize="13px"
                    android:layout_height="wrap_content" />
                <RadioButton android:id="@+id/rad3" android:text="Button3"
                    android:layout_width="105px" android:textSize="13px"
                    android:layout_height="wrap_content" />
        </TableRow>
        <TableRow>
                <RadioButton android:id="@+id/rad1" android:text="Button1"
                    android:layout_width="105px" android:layout_height="wrap_content"
                    android:textSize="13px" />
                <RadioButton android:id="@+id/rad2" android:text="Button2"
                    android:layout_width="105px" android:textSize="13px"
                    android:layout_height="wrap_content" />
                <RadioButton android:id="@+id/rad3" android:text="Button3"
                    android:layout_width="105px" android:textSize="13px"
                    android:layout_height="wrap_content" />
        </TableRow>
    </com.example.android.view.ToggleButton>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to add button click event by clicking design of axml? if
Is it possible to add an image(view) on top of a button (which as
Can anyone tell me if it is possible to create and add data to
Possible Duplicate: add an image to a html type input check box or radio
I'd like to ensure that there's never a line break between a radio button
Is it possible to add or remove slides in runtime using FlexSlider ?
Is it possible to add the OR operator to php isset submit form code
Is it possible to add a table view on the cells of a table
Is it possible to add an Argument to an python argparse.ArgumentParser without it showing
Is it possible to add to PHP objects on the fly? Say I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.