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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:22:57+00:00 2026-06-06T03:22:57+00:00

I want a 2-column ScrollView . In each column, there should be an ImageButton

  • 0

I want a 2-column ScrollView. In each column, there should be an ImageButton:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_height="800dp"
android:background="#FFF"
android:layout_width="600dp" >

<LinearLayout
    android:id="@+id/categoryLinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</LinearLayout>

</ScrollView>

And the code:

        LinearLayout sv = (LinearLayout) findViewById(R.id.categoryLinearLayout1);

    for (int i = 0; i < 10; i++) {
        ImageButton ib = new ImageButton(this);
        // ib.setImageDrawable(getResources().getDrawable(R.drawable.cat1));

        Bitmap bmp = BitmapFactory.decodeResource(getResources(),
                R.drawable.cat1);
        int width = 300;
        int height = 300;
        Bitmap resizedbitmap = Bitmap.createScaledBitmap(bmp, width,
                height, true);
        ib.setImageBitmap(resizedbitmap);
        sv.addView(ib);
    }

But in this way, all 10 ImageButtons horizontally. What I need is, put 2 ImageButton in a row (it makes 600px) and go down, put more 2 ImageButtons etc. So there will be 5 rows for 10 ImageButtons.

How can I do that?

  • 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-06T03:22:59+00:00Added an answer on June 6, 2026 at 3:22 am

    Use a TableLayout:

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView1"
    android:layout_height="800dp"
    android:background="#FFF"
    android:layout_width="600dp" >
    
    <TableLayout
        android:id="@+id/categoryLinearLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </TableLayout>
    
    </ScrollView>
    

    Then in your code:

    TableLayout sv = (TableLayout) findViewById(R.id.categoryLinearLayout1);
    
    for (int i = 0; i < 5; i++) {
        TableRow tr = new TableRow(this);
        tr.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
        for (int j = 0; j < 2; j++) {
             ImageButton ib = new ImageButton(this);
             // ib.setImageDrawable(getResources().getDrawable(R.drawable.cat1));
             Bitmap bmp = BitmapFactory.decodeResource(getResources(),
                  R.drawable.cat1);
             int width = 300;
             int height = 300;
             Bitmap resizedbitmap = Bitmap.createScaledBitmap(bmp, width,
                height, true);
             ib.setImageBitmap(resizedbitmap);
             ib.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
             tr.addView(ib);
         }
         sv.add(tr); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this TableLayout: <?xml version=1.0 encoding=utf-8?> <ScrollView xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/layout android:layout_height=fill_parent android:layout_alignParentBottom=true android:scrollbars=horizontal|vertical android:layout_width=fill_parent
<ScrollView android:layout_width=fill_parent android:layout_height=wrap_content xmlns:android=http://schemas.android.com/apk/res/android> <HorizontalScrollView android:layout_width=fill_parent android:layout_height=wrap_content> <TableLayout android:id=@+id/test_table android:layout_width=match_parent android:layout_height=fill_parent android:orientation=horizontal> <TableRow android:id=@+id/column_01
Having the following wpf code: <Window x:Class=WpfApplication5.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:c=clr-namespace:WpfApplication5 Title=Window1 Height=300 Width=300> <Window.Resources>
I have a ListView with a GridView with 3 columns. I want last column
I want to know column index of header in AdvancedDataGrid when a user clicks
I want to Update Column of a Table where ColumnName will be DropDown.SelectedValue. Example:
I have class and I want to initalize column that stores pictuer with type
I have a map and I want the first column i.e (*it).first to be
I have a devise user model with pro boolean column.I want to build a
I want to trim the column headers of a CSV file, fields below is

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.