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

  • SEARCH
  • Home
  • 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 7707707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:25:41+00:00 2026-06-01T00:25:41+00:00

I have a ListView ( my_list.xml ): <ListView android:id=@+id/my_list android:layout_width=wrap_content android:layout_height=wrap_content android:choiceMode=singleChoice /> The

  • 0

I have a ListView (my_list.xml):

 <ListView
        android:id="@+id/my_list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:choiceMode="singleChoice"
      />

The layout for each list item is (list_item.xml):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="10dp"
    >

    <ImageView 
          android:id = "@+id/my_icon" 
          android:layout_width ="wrap_content" 
          android:layout_height ="wrap_content"
          android:layout_centerVertical="true"  
     /> 
    <TextView 
         android:id="@+id/my_str" 
         android:layout_width="wrap_content" 
         android:layout_height = "wrap_content" 
         android:layout_toRightOf="@id/my_icon"
     /> 

     <!--This radio button makes the list item unselectable, why?-->
     <RadioButton 
         android:id="@+id/my_radio_btn"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_centerVertical="true"
         android:layout_alignParentRight="true"
         />
</RelativeLayout>

In Java code, I use SimpleAdapter for the list:

my_list = (ListView) findViewById(R.id.my_list);

SimpleAdapter adapter = new SimpleAdapter(context, getOptions(),
           R.layout.list_item, 
           new String[] { "icon1","str1" }, 
           new int[] {R.id.my_icon, R.id.my_str });

my_list.setAdapter(adapter);

//onClickListener does not work after I added RadioButton in list item layout
my_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {

            Log.v("SELECTED", position+""); 
        }
    });

As you see, in above code, in the list item layout, I added a RadioButton, after I added this button, my list onClickListener does not work anymore, why?? (It works if it’s without RadioButton on list item layout)

  • 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-01T00:25:43+00:00Added an answer on June 1, 2026 at 12:25 am

    Set the following properties to your RadioButton:

    android:focusable="false"
    android:focusableInTouchMode="false"
    

    and in your OnItemClickListener, you need to set the radio button’s checked flag by code.


    Set you ListView as below:

    <ListView
      android:id="@+id/my_list"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem my ListActivity . I have this xml: <LinearLayout> <ListView android:id=@android:id/list
I have a ListView, and I want to customize the layout of each item
I have a ListView in my layout. Here is the layout for list item.
I have an xml layout which I use for each row in my listview:
I have a problem with listview which list item contain a checkbox. When i
I have a problem with my Android listview. My list uses a custom arrayadapter,
I have a list view declared in my xml: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have an Activity in Android, with two elements: EditText ListView When my Activity
I have created a listview using the default ArrayAdapter. However, to select an item
Android empty list layout Whatever I do, I can't get the empty tag to

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.