Java Code Examples for android.text.TextPaint#setShader()

The following examples show how to use android.text.TextPaint#setShader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RNLinearTextGradientSpan.java    From react-native-text-gradient with MIT License 5 votes vote down vote up
@Override
public void updateDrawState(TextPaint paint) {
  if (mGradient != null) {
    paint.setStyle(Paint.Style.FILL);
    paint.setShader(mGradient);
  }
}
 
Example 2
Source File: RainbowSpanActivity.java    From advanced-textview with Apache License 2.0 5 votes vote down vote up
@Override
public void updateDrawState(TextPaint paint) {
  paint.setStyle(Paint.Style.FILL);
  Shader shader = new LinearGradient(0, 0, 0, paint.getTextSize() * colors.length, colors, null,
      Shader.TileMode.MIRROR);
  Matrix matrix = new Matrix();
  matrix.setRotate(90);
  shader.setLocalMatrix(matrix);
  paint.setShader(shader);
}
 
Example 3
Source File: AboutActivity.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void updateDrawState(TextPaint paint) {
	paint.setStyle(Paint.Style.FILL);
	Shader shader = new LinearGradient(0, 0, 0, paint.getTextSize()
			* colors.length, colors, null, Shader.TileMode.MIRROR);
	Matrix matrix = new Matrix();
	matrix.setRotate(90);
	shader.setLocalMatrix(matrix);
	paint.setShader(shader);
}
 
Example 4
Source File: SettingFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void updateDrawState(TextPaint paint) {
	paint.setStyle(Paint.Style.FILL);
	Shader shader = new LinearGradient(0, 0, 0, paint.getTextSize()
			* colors.length, colors, null, Shader.TileMode.MIRROR);
	Matrix matrix = new Matrix();
	matrix.setRotate(90);
	shader.setLocalMatrix(matrix);
	paint.setShader(shader);
}
 
Example 5
Source File: SettingFragment.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void updateDrawState(TextPaint paint) {
	paint.setStyle(Paint.Style.FILL);
	Shader shader = new LinearGradient(0, 0, 0, paint.getTextSize()
			* colors.length, colors, null, Shader.TileMode.MIRROR);
	Matrix matrix = new Matrix();
	matrix.setRotate(90);
	shader.setLocalMatrix(matrix);
	paint.setShader(shader);
}
 
Example 6
Source File: SpannableStringUtils.java    From DevUtils with Apache License 2.0 4 votes vote down vote up
@Override
public void updateDrawState(final TextPaint tp) {
    tp.setShader(mShader);
}
 
Example 7
Source File: SpanUtils.java    From AndroidUtilCode with Apache License 2.0 4 votes vote down vote up
@Override
public void updateDrawState(final TextPaint tp) {
    tp.setShader(mShader);
}