Exemplo n.º 1
0
  public void loadTable() {
    TableLayout table = (TableLayout) findViewById(R.id.table);
    // table.setColumnStretchable(1, true);
    table.removeAllViews();

    final ArrayList<View> rowList = new ArrayList<View>();

    for (int i = 0; i < balance.size(); i++) {
      // final LoaderImageView image = new LoaderImageView(getContext(), getUsersmallimg());
      final LoaderImageView image =
          new LoaderImageView(
              getContext(),
              balance.get(i).getApp().getImageUrl(),
              (int) (ratio * 60),
              (int) (ratio * 60));

      TableRow row =
          createRow(
              image,
              balance.get(i).getApp().getName(),
              balance.get(i).getCreationdate(),
              balance.get(i).getValue(),
              balance.get(i).getReason(),
              getContext());
      row.setId(i);
      rowList.add(row);
      View spacer = createSpacer(getContext(), 1, 1);
      spacer.setId(-100);
      rowList.add(spacer);
      View spacer2 = createSpacer(getContext(), 2, 1);
      spacer2.setId(-100);
      rowList.add(spacer2);
      BeButton b = new BeButton(current.getContext());
      if (i % 2 == 0)
        row.setBackgroundDrawable(
            b.setPressedBackg(
                new BDrawableGradient(0, (int) (ratio * 70), BDrawableGradient.LIGHT_GRAY_GRADIENT),
                new BDrawableGradient(0, (int) (ratio * 70), BDrawableGradient.HIGH_GRAY_GRADIENT),
                new BDrawableGradient(
                    0, (int) (ratio * 70), BDrawableGradient.HIGH_GRAY_GRADIENT)));
      else
        row.setBackgroundDrawable(
            b.setPressedBackg(
                new BDrawableGradient(0, (int) (ratio * 70), BDrawableGradient.GRAY_GRADIENT),
                new BDrawableGradient(0, (int) (ratio * 70), BDrawableGradient.HIGH_GRAY_GRADIENT),
                new BDrawableGradient(
                    0, (int) (ratio * 70), BDrawableGradient.HIGH_GRAY_GRADIENT)));
    }

    for (View row : rowList) {
      table.addView(row);
    }
  }