简体   繁体   中英

How to remove Rendering Problems message window in Intellij IDEA 13 layout preview

那么如何在每次更改布局中的内容时,如何彻底删除Intellij IDEA 13中Android布局预览区域上方出现的“渲染问题”消息?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM