So how to completely remove this "Rendering Problems" message which appears above Android Layout Preview area in Intellij IDEA 13 each time you change something in your layout?
You can use isInEditMode method.
Check Example:
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.ProgressBar;
public class ColoredProgressBar extends ProgressBar {
public ColoredProgressBar(Context context) {
super(context);
if (!isInEditMode())
init();
}
public ColoredProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
if (!isInEditMode())
init();
}
public ColoredProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (!isInEditMode())
init();
}
/**
* Changes color.
*/
private void init() {
getIndeterminateDrawable().setColorFilter(Color.BLUE, android.graphics.PorterDuff.Mode.MULTIPLY);
}
}
Example link: https://gist.github.com/emreaktrk/9524973
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With