Code example for TextView

Methods: setIdsetLayoutParamssetShadowLayersetSingleLinesetTextColorsetTextSizesetTypeface

0
      authorTextView.setTextColor(color);
    } 
  } 
   
  private void loadDateLabel(Context context) {
    dateTextView = new TextView(context);
    dateTextView.setId(DATE_TEXT_VIEW_ID);
 
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 20.0, 
        getResources().getDisplayMetrics());
     
    params.setMargins(margin, 0, margin, 0);
    dateTextView.setLayoutParams(params);
    dateTextView.setShadowLayer(1, 0, 1, Color.WHITE);
    dateTextView.setSingleLine(true);
    dateTextView.setTextColor(Color.GRAY);
    dateTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
    dateTextView.setTypeface(null, Typeface.ITALIC);
     
    addView(dateTextView);
  } 
   
  /** 
Connect your IDE to all the code out there  Get Codota for Java