コード例 #1
0
  private void updateSelectedScore(int oldScore, int newScore) {
    if (oldScore != RatingBar.SCORE_NOT_SET) {
      TextView oldScoreView = mScoreViews[oldScore];
      oldScoreView.setTextColor(mColorNotSelected);
      oldScoreView.setTextSize(ScreenUtils.pxToDp(mScoreTextSizeNotSelected));
    }

    TextView newScoreView = mScoreViews[newScore];
    newScoreView.setTextColor(mColorSelected);
    newScoreView.setTextSize(ScreenUtils.pxToDp(mScoreTextSizeSelected));
  }
コード例 #2
0
  private TextView buildScoreView(int score) {
    TextView scoreView = new TextView(mContext);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f);
    scoreView.setLayoutParams(params);

    scoreView.setGravity(Gravity.CENTER);
    scoreView.setText(String.valueOf(score));
    scoreView.setTextSize(ScreenUtils.pxToDp(mScoreTextSizeNotSelected));
    scoreView.setTextColor(mColorNotSelected);

    return scoreView;
  }