com.zx.zxutils.views.TableView.ZXTableKeyValues类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中com.zx.zxutils.views.TableView.ZXTableKeyValues类的一些代码示例,展示了ZXTableKeyValues类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZXTableKeyValues类的具体详情如下:
包路径:com.zx.zxutils.views.TableView.ZXTableKeyValues
类名称:ZXTableKeyValues

ZXTableKeyValues介绍

暂无

代码示例

代码示例来源:origin: StannyBing/ZXUtils

public ZXTableView setTableList(List<ZXTableKeyValues> tableList) {
  this.tableList.clear();
  this.tableList.addAll(tableList);
  int titleCount = 0;
  double valueSum = 0;
  for (int i = 0; i < tableList.size(); i++) {
    titleCount = titleCount < tableList.get(i).getTitleSum() ? tableList.get(i).getTitleSum() : titleCount;//获取最大title长度
    valueSum += tableList.get(i).getValue();//获取值的总数
  }
  if (valueSum == 0) {
    valueSum = 1;
  }
  tableAdapter.titleCount = titleCount;
  tableAdapter.valueSum = valueSum;
  if (tableAdapter.showTitleView) {
    ZXTableKeyValues titleValue = new ZXTableKeyValues();
    titleValue.setTitle(true);
    this.tableList.add(0, titleValue);
  }
  tableAdapter.notifyDataSetChanged();
  return this;
}

代码示例来源:origin: StannyBing/ZXUtils

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
  Holder myHolder = (Holder) holder;
  ZXTableKeyValues tableEntity = tableList.get(position);
  setViewVisible(myHolder, position);
  setColor(myHolder, tableEntity);
  DecimalFormat df = new DecimalFormat("######0.00");
  if (tableEntity.isTitle()) {
    myHolder.tvKey.setText(key);
    myHolder.tvItem1.setText(value1);
    myHolder.tvItem2.setText(value2);
    myHolder.tvItem3.setText(value3);
    myHolder.tvPercent.setText("占比");
  } else {
    myHolder.tvKey.setText(tableEntity.getKey());
    myHolder.tvItem1.setText(df.format(tableEntity.getValue()) + "");
    myHolder.tvItem2.setText(df.format(tableEntity.getValue2()) + "");
    myHolder.tvItem3.setText(df.format(tableEntity.getValue3()) + "");
    if (valueSum == 0) {
      myHolder.tvPercent.setText("0%");
    } else {
      myHolder.tvPercent.setText(df.format(tableEntity.getValue() * 100 / valueSum) + "%");
    }
  }
}

代码示例来源:origin: StannyBing/ZXUtils

public List<ZXTableKeyValues> getList(int length) {
    List<ZXTableKeyValues> tableList = new ArrayList<>();
    for (int i = 0; i < length; i++) {
      ZXTableKeyValues key = new ZXTableKeyValues("第" + i + "个", Math.random() * 100);
      tableList.add(key);
    }
    return tableList;
  }
}

代码示例来源:origin: StannyBing/ZXUtils

@Override
public void OnItemClick(View view, int position) {
  ZXToastUtil.showToast(tableView.getTableList().get(position).getValue() + "");
  tableView.showBackIcon(true).setTableList(getList(10));
}
@Override

代码示例来源:origin: StannyBing/ZXUtils

/**
 * 修改颜色
 *
 * @param myHolder
 * @param tableEntity
 */
private void setColor(Holder myHolder, ZXTableKeyValues tableEntity) {
  if (tableEntity.isTitle()) {
    myHolder.llTable.setBackgroundColor(titleBgColor);
    myHolder.tvKey.setTextColor(ContextCompat.getColor(context, R.color.whitesmoke));
    myHolder.tvItem1.setTextColor(ContextCompat.getColor(context, R.color.whitesmoke));
    myHolder.tvItem2.setTextColor(ContextCompat.getColor(context, R.color.whitesmoke));
    myHolder.tvItem3.setTextColor(ContextCompat.getColor(context, R.color.whitesmoke));
    myHolder.tvPercent.setTextColor(ContextCompat.getColor(context, R.color.whitesmoke));
  } else {
    myHolder.llTable.setBackgroundColor(ContextCompat.getColor(context, R.color.whitesmoke));
    myHolder.tvKey.setTextColor(ContextCompat.getColor(context, R.color.gray));
    myHolder.tvItem1.setTextColor(ContextCompat.getColor(context, R.color.gray));
    myHolder.tvItem2.setTextColor(ContextCompat.getColor(context, R.color.gray));
    myHolder.tvItem3.setTextColor(ContextCompat.getColor(context, R.color.gray));
    myHolder.tvPercent.setTextColor(ContextCompat.getColor(context, R.color.gray));
  }
}

相关文章