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 7945461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:52:24+00:00 2026-06-04T00:52:24+00:00

I need to create a ListView or TableLayout that each row consists of 3

  • 0

I need to create a ListView or TableLayout that each row consists of 3 columns and 3 buttons, something similar to that:

enter image description here

but the screen will not only contains this control will contains textfields and other layouts , I need a grid to take the shape like as the following (for example ).

Any idea on how to achieve that and how to handle Button clicks on it?
As I am new to Android I don’t know how to create that.

enter image description here

  • 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-04T00:52:26+00:00Added an answer on June 4, 2026 at 12:52 am

    A ListViewis used mainly for mutable data. If you have some sort of data that can be displayed the same way everytime and it can grow/be deleted, then a ListView is a good option.

    On the other way if you have static data, static Layouts (like TableLayout, LinearLayout, etc) are a good option. It all depends on what data you have and how you want to use it.

    I hope you don’t want to to do the same columns you have on that screenshot because you don’t have that space on a smartphone.

    Let’s assume you want 3 columns, and that data is mutable.

    You can use a costum ListView with a LinearLayout in the root with the android:orientation="horizontal. Then each element on you insert you need to use layout_weight="1" with the android:layout_width="0dp". This combination guarantees that each element on your ListView row will have the same width, so it is kinda optional.

    Your costum list row should seem something like this:

    <LinearLayout
        android:layout_width="fill_parent"
        ...
        android:orientation="horizontal" >
    <TextView
       android:layout_width="0dp"
       ...
       android:layout_weight="1" />
    ...
    

    To handle the button click you need to do a setOnClickListener in the Button when you get it in the getView method inside the adapter on your costum ListView.

    Then you probly will have problems clicking the button and the ListView. A common way to solve that is to put the button as android:focusable="false" at the xml where you declare it. But one thing at a time 😉

    EDIT (because of the comment: Adding a checkbox that disable/enables a button):

    If you want a checkbox to disable/enable buttons you need to do some work on your getView in the adapter of your costum ListView.

    You need to:

    • Get your Checkbox using something like: CheckBox myCheckBox = (CheckBox) inflater.findViewById(R.id.checkboxid) where the inflater is the one you defined in the getView and the checkboxid is the id you defined at your xml row.
    • Save the button to be acessible in your checkbox listener: myCheckBox.setTag(button) where the button is the button you want to enable/disable and you can get him the same way you got the myCheckBox
    • Set a setOnCheckedChangeListener on your checkbox where you change the visibility of your button depending on the state of the checkbox.

    The last bullet should sound something like this:

    myCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Button myButton = (Button) buttonView.getTag();
    
            if ( isChecked ) 
                myButton.setVisibility(View.VISIBLE);
            else
                // Use GONE if you want to get that space for other views
                myButton.setVisibility(View.GONE); 
    
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a very small ListView. Each row could have a different
I need to create and populate a ListView with 3 strings that come from
I need to create radio buttons in listview. I need to select any one
I need to create interface that will look like order. So, there will be
So I'm trying to create a screen which has a ListView and over that
I need to create a ListView in Android that has headers and is multiline.
I need create clone repository. but I do not know where can I get
Need to create a custom DNS name server using C which will check against
I am working on android applications. In my project I need to create Listview.
I'm trying to create a ListView with items that have two lines of text,

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.