Hey Guys, So my problem is i have tried almost everything i can think of to center a programitacally created table in a programitically created layout.
I've tried all the usual layout params center setting but still nothing: Score List is a set of pairs of scores (Name, Score). I'm just looping through and adding them to cells in a table and its always aligned left when i run it. ArrayList<Score> scoreList = new ArrayList<Score>(); public LinearLayout getHighScoresView(Context context) { final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); RelativeLayout relLay = new RelativeLayout(context); LinearLayout linLay = new LinearLayout(context); TableLayout td = new TableLayout(context); TextView name; TextView score; TableRow tr; TableLayout.LayoutParams lopForMainRow = new TableLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); lopForMainRow.gravity = Gravity.CENTER_HORIZONTAL; td.setLayoutParams(lopForMainRow); for (int i = 0; i < scoreList.size(); i++) { tr = new TableRow(context); name = new TextView(context); score = new TextView(context); name.setText(scoreList.get(i).name); score.setText(Integer.toString(scoreList.get(i).score)); tr.addView(name); tr.addView(score); td.addView(tr); } relLay.addView(td, lopForMainRow); linLay.setOrientation(LinearLayout.HORIZONTAL); linLay.addView(relLay); linLay.setGravity(Gravity.CENTER); return linLay; } Cheers Adrian -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en