示例#1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    rootView = inflater.inflate(R.layout.fragment_scores, container, false);
    rootLayout = (LinearLayout) rootView.findViewById(R.id.scoresLinearLayoutContainer);
    layout = (LinearLayout) rootView.findViewById(R.id.scoresLinearLayout);
    /*
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity= Gravity.CENTER_HORIZONTAL;

    layout.setLayoutParams(params);
    */
    multiplier = 10;
    containerId = 7;
    homeScoreId = 4;
    awayScoreId = 5;
    plusButton = (ImageButton) rootView.findViewById(R.id.plusButton);
    minusButton = (ImageButton) rootView.findViewById(R.id.minusButton);
    saveRoundButton = (Button) rootView.findViewById(R.id.saveRoundButton);
    roundTextView = (TextView) rootView.findViewById(R.id.roundTextView);
    containerIDs = new ArrayList<Integer>();
    homeScoreIDs = new ArrayList<Integer>();
    awayScoreIDs = new ArrayList<Integer>();
    this.tournament = new Tournament();
    tournament.setId(TEMP_ID);
    loader = new Loader(getActivity().getBaseContext());
    plusButton.setOnClickListener(this);
    minusButton.setOnClickListener(this);
    saveRoundButton.setOnClickListener(this);

    activeRound = 1;
    // textView = (TextView) rootView.findViewById(R.id.textViewScores);
    return rootLayout;
  }