[EMAIL PROTECTED] wrote:
> I'm providing LayoutParams - not of the TableLayout variety, however I
> did this in a different place and it worked fine.

In the end, you may need to use the hierarchyviewer tool (in the tools/ 
directory of your SDK) to determine if the child views are being 
properly added and just not being laid out as expected, or if the add is 
somehow quietly failing.

http://androidguys.com/?p=677

You might also consider inflating the rows, so you can lay them out in 
XML and not get bitten by problems wiring things together.

> Here is the code I've used:
> 
>       //INFLATE SCORES TABLE FROM SCORESDIALOG
>       View highScoresView = factory.inflate(R.layout.scoresdialog, null);
> 
>       TableLayout scoreTable = (TableLayout) highScoresView.findViewById
> (R.id.scoreTable);
> 
>       //DEFINE A DIVIDER, AND VARIOUS LAYOUT PARAMETERS
>       LayoutParams fillwrap = new LayoutParams
> (LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
>       LayoutParams dividerparams = new LayoutParams
> (2,LayoutParams.WRAP_CONTENT);
> 
>       //GENERATE AND FILL THE HIGH SCORES TABLE
>       String instr;
>       while ((instr = scoreReader.readLine())!=null){
>               String nameplusscore[] = instr.split("-");
>               TableRow newScoreRow = new TableRow(this);
>               TextView playername = new TextView(this);
>               playername.setText(nameplusscore[0]);
>               TextView playerscore = new TextView(this);
>               playerscore.setText(nameplusscore[1]);
>               View dividerview = new View(this);
>               Log.d("table constructor","adding view to row");
>               newScoreRow.addView(playername, fillwrap);
>               Log.d("table constructor","adding view2 to row");
>               newScoreRow.addView(dividerview, dividerparams);
>               Log.d("table constructor","adding view3 to row");
>               newScoreRow.addView(playerscore,fillwrap);
>               Log.d("table constructor","adding row to table");
>               scoreTable.addView(newScoreRow,fillwrap);
>       }
>       scoresIn.close();

You are reusing fillwrap. I haven't tried reusing LayoutParams objects, 
so I don't know if reusing them is kosher.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.4 Published!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to