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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:04:05+00:00 2026-06-10T14:04:05+00:00

my question is like putting a ScrollView HorizontalScrollView and a table containing TextView Array.

  • 0

my question is like putting a ScrollView HorizontalScrollView and a table containing TextView Array.

This is my main.java:

public class tabla extends Activity {

    SitesList sitesList = null;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tabla);

        TableLayout layout =(TableLayout)findViewById(R.id.tabla);

        TableRow tr[] = new TableRow[80];

        TextView variacion[];
        TextView nemotecnico[];
        TextView precio[];

        try {

            /** Handling XML */
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();

            /** Send URL to parse XML Tags */
            URL sourceUrl = new URL("http://www.bovalpo.com/cgi-local/xml_bcv.pl?URL=75");

            /** Create handler to handle XML Tags ( extends DefaultHandler ) */
            MyXMLHandler myXMLHandler = new MyXMLHandler();
            xr.setContentHandler(myXMLHandler);
            xr.parse(new InputSource(sourceUrl.openStream()));

        } catch (Exception e) {
            System.out.println("XML Pasing Excpetion = " + e);
        }

        /** Get result from MyXMLHandler SitlesList Object */
        sitesList = MyXMLHandler.sitesList;

        /** Assign textview array lenght by arraylist size */

        nemotecnico = new TextView[sitesList.getNemotecnico().size()];
        variacion = new TextView[sitesList.getVariacion().size()];
        precio = new TextView[sitesList.getPrecio().size()];


        /** Set the result text in textview and add it to layout */
        for (int i = 0; i < sitesList.getRegistro().size(); i++) {

            variacion[i] = new TextView(this);
            variacion[i].setText("   " +sitesList.getVariacion().get(i));

            nemotecnico[i] = new TextView(this);
            nemotecnico[i].setText("   " +sitesList.getNemotecnico().get(i));

            precio[i]  = new TextView(this);
            precio[i].setText("   " + sitesList.getPrecio().get(i));

            Pattern pattern = Pattern.compile("^([a-z: ]*)?+(\\+?[0-9]+([,\\.][0-9]*)?)$");
            Matcher matcher = pattern.matcher(sitesList.getVariacion().get(i));
            if (!matcher.matches())

                variacion[i].setTextColor(Color.parseColor("#ff0000"));
            else
                variacion[i].setTextColor(Color.parseColor("#008000")); 


        }   
        for (int i = 0; i < 80; i++) {
            tr[i] = new TableRow(this);

            tr[i].addView(nemotecnico[i], new TableRow.LayoutParams(1));
            tr[i].addView(precio[i], new TableRow.LayoutParams(2));
            tr[i].addView(variacion[i], new TableRow.LayoutParams(3));

            layout.addView(tr[i], new TableLayout.LayoutParams());

        }
        /** Set the layout view to display */
        setContentView(layout);

    }    
}

As you see in my code:

TableLayout layout =(TableLayout)findViewById(R.id.tabla);  

TableRow tr[] = new TableRow[80];

TextView variacion[];
TextView nemotecnico[];
TextView precio[];

And show the TextView in TableRow

for (int i = 0; i < 80; i++) {
    tr[i] = new TableRow(this);

    tr[i].addView(nemotecnico[i], new TableRow.LayoutParams(1));
    tr[i].addView(precio[i], new TableRow.LayoutParams(2));
    tr[i].addView(variacion[i], new TableRow.LayoutParams(3));

    layout.addView(tr[i], new TableLayout.LayoutParams());

}
/** Set the layout view to display */
setContentView(layout);

But i can’t put HorizontalScrollView and ScrollView because my Xml is as shown below.

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/tabla"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/fondo" >

</TableLayout>

Much appreciate your help, thanks!.

  • 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-10T14:04:07+00:00Added an answer on June 10, 2026 at 2:04 pm

    I don’t understand why you cannot wrap your entire table in both vertical and horizontal scroll views or wrap the individual cells (whichever you prefer). The first option looks like this:

    <ScrollView ...>
        <HorizontalScrollView ...>
            <TableLayout ...>
        </HorizontalScrollView>
    </ScrollView>
    

    However this only allows the user to scroll horizontally or vertically for each gesture, not diagonally. But this question covers creating a two dimensional ScrollView: Scrollview vertical and horizontal in android.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I posted this question Putting a simple expression language into java and got
Previously Id asked this question Putting a simple expression language into java about allowing
Quick question! Does putting a clear element INSIDE a floated div do anything? Like:
My question like this: I have a JTable, I put a JProgressBar in one
I have the same question like this: Delay before showing the tooltip I need
First of all there is probably a question like this already but i couldn't
I had an interview days ago and was thrown a question like this. Q:
I don't know if this is the right place to ask a question like
My question is like this: Reordering UITableView without reorder control , I use these
I have seen code like this package xyz; # putting the module inside its

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.