/** Creates the Player's positions on the table (BoardView) */ public void displayPlayers() { RelativeLayout players_left = (RelativeLayout) findViewById(R.id.players_left); RelativeLayout players_right = (RelativeLayout) findViewById(R.id.players_right); PlayerView player = new PlayerView(context); RelativeLayout.LayoutParams params; player = new PlayerView(context); params = (RelativeLayout.LayoutParams) player.getLayoutParams(); params.addRule(CENTER_IN_PARENT, RelativeLayout.TRUE); params.addRule(ALIGN_PARENT_LEFT, RelativeLayout.TRUE); players_left.addView(player, params); playerViews.put(1, player); // Player 2 player = new PlayerView(context); params = (RelativeLayout.LayoutParams) player.getLayoutParams(); params.addRule(ALIGN_PARENT_TOP, RelativeLayout.TRUE); params.addRule(ALIGN_PARENT_LEFT, RelativeLayout.TRUE); players_left.addView(player, params); playerViews.put(2, player); // Player 3 player = new PlayerView(context); params = (RelativeLayout.LayoutParams) player.getLayoutParams(); params.addRule(CENTER_IN_PARENT, RelativeLayout.TRUE); params.addRule(ALIGN_PARENT_TOP, RelativeLayout.TRUE); players_left.addView(player, params); playerViews.put(3, player); // Player 4 player = new PlayerView(context); params = (RelativeLayout.LayoutParams) player.getLayoutParams(); params.addRule(ALIGN_PARENT_TOP, RelativeLayout.TRUE); params.addRule(CENTER_IN_PARENT, RelativeLayout.TRUE); addView(player, params); bringChildToFront(player); playerViews.put(4, player); // Player 5 player = new PlayerView(context); params = (RelativeLayout.LayoutParams) player.getLayoutParams(); params.addRule(CENTER_IN_PARENT, RelativeLayout.TRUE); params.addRule(ALIGN_PARENT_TOP, RelativeLayout.TRUE); players_right.addView(player, params); playerViews.put(5, player); // Player 6 player = new PlayerView(context); params = (RelativeLayout.LayoutParams) player.getLayoutParams(); params.addRule(ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); params.addRule(ALIGN_PARENT_TOP, RelativeLayout.TRUE); players_right.addView(player, params); playerViews.put(6, player); // Player 7 player = new PlayerView(context); params = (RelativeLayout.LayoutParams) player.getLayoutParams(); params.addRule(CENTER_IN_PARENT, RelativeLayout.TRUE); params.addRule(ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); players_right.addView(player, params); playerViews.put(7, player); }