lblDate = new TextView(
PromotionProfile.this);
lblDate.setText(submitDate);
lblDate.setTextSize(16);
lblDate.setTextColor(Color.WHITE);
lblDate.setPadding(10, 5, 5, 0);
lblID = new TextView(PromotionProfile.this);
lblID.setText("ID " + loginID);
lblID.setGravity(Gravity.RIGHT);
lblID.setTextSize(16);
lblID.setTextColor(Color.WHITE);
lblID.setPadding(0, 5, 10, 5);
lbl_brand = new TextView(
PromotionProfile.this);
lbl_brand.setText(merchantName);
lbl_brand.setTextSize(16);
lbl_brand.setTextColor(Color.BLACK);
lbl_brand.setPadding(10, 5, 5, 0);
lbl_pts = new TextView(
PromotionProfile.this);
lbl_pts.setText(points + " Points");
lbl_pts.setTextSize(16);
lbl_pts.setGravity(Gravity.RIGHT);
lbl_pts.setTextColor(Color.BLACK);
lbl_pts.setPadding(0, 5, 10, 5);
row1 = new TableRow(PromotionProfile.this);
row2 = new TableRow(PromotionProfile.this);
row1.addView(lblDate);
row1.addView(lblID);
row2.addView(lbl_brand);
row2.addView(lbl_pts);
tbPoints.addView(row1);
tbPoints.addView(row2);
我想让 lblID 和 lbl_pts 在表格列中向右对齐。我已经尝试过RelativeLayout.LayoutParams 方法,但仍然无法解决..我可以知道解决方案吗?多谢。