ij.gui.Toolbar.setBackgroundColor()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中ij.gui.Toolbar.setBackgroundColor()方法的一些代码示例,展示了Toolbar.setBackgroundColor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setBackgroundColor()方法的具体详情如下:
包路径:ij.gui.Toolbar
类名称:Toolbar
方法名:setBackgroundColor

Toolbar.setBackgroundColor介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

mAppBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
   @Override
   public void onStateChanged(AppBarLayout appBarLayout, State state) {
     Toolbar toolbar = (Toolbar) mAppBarLayout.findViewById(R.id.toolbar_top);
     int toolbarBackground = (state == AppBarStateChangeListener.State.COLLAPSED) ? R.color.color_collapsed : R.color.color_non_collapsed;
     toolbar.setBackgroundColor(ContextCompat.getColor(DealsOptionsActivity.this, toolbarBackground));
   }
 });

代码示例来源:origin: stackoverflow.com

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  toolbar.setBackgroundColor(Color.CYAN);
}

代码示例来源:origin: stackoverflow.com

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setBackgroundColor(Color.BLACK);

代码示例来源:origin: stackoverflow.com

toolbar.inflateMenu(R.menu.menu_settings);
  toolbar.setNavigationIcon(null);
  toolbar.setBackgroundColor(getResources().getColor(R.color.red));
} else {
  toolbar.setTitle("Toolbar Test 1");
  toolbar.inflateMenu(R.menu.menu_testing_action_bar);
  toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.nav_tint));
  toolbar.setBackgroundColor(getResources().getColor(R.color.primary));

代码示例来源:origin: stackoverflow.com

public class FragmentOne extends Fragment {
Toolbar toolbar;
 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);
 toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    }
     @Override
     public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if (isVisibleToUser)
        {
         toolbar.setBackgroundColor(ContextCompat.getColor(getApplicationContext(),R.color.classColor2));  
       }
      }
    }

代码示例来源:origin: stackoverflow.com

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
  View v =  inflater.inflate(R.layout.fragment_map, container, false);

  Toolbar toolbar = (Toolbar) v.findViewById(R.id.actionBar);
  toolbar.setBackgroundColor(Color.parseColor("#212121"));

  //---- changes ---
  ((MapActivity) getActivity()).setTitle(Html.fromHtml("<font color='#FFFFFF'>" + getResources().getString(R.string.map) + "</font>"));
  ((MapActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  ((MapActivity) getActivity()).getSupportActionBar().setDisplayShowHomeEnabled(false);

  return v;
}

代码示例来源:origin: net.imagej/ij

private void setBackgroundColor(Color c) {
  Toolbar.setBackgroundColor(c);
  if (Recorder.record)
    Recorder.record("setBackgroundColor", c.getRed(), c.getGreen(), c.getBlue());
}

代码示例来源:origin: stackoverflow.com

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.feedback_activity);

  Toolbar tb = (Toolbar) findViewById(R.id.fb_toolbar);
  setSupportActionBar(tb);

  //Parse a color with any hex code
  tb.setBackgroundColor(Color.parseColor("#FFFFFF"));
  //Set title
  tb.setTitle("Your title");
}

代码示例来源:origin: imagej/ImageJA

private void setBackgroundColor(Color c) {
  Toolbar.setBackgroundColor(c);
  if (Recorder.record)
    Recorder.record("setBackgroundColor", c.getRed(), c.getGreen(), c.getBlue());
}

代码示例来源:origin: stackoverflow.com

ab.setCustomView(R.layout.actionbar_main);

Toolbar parent =(Toolbar) ab.getCustomView().getParent();
parent.setContentInsetsAbsolute(0,0);
parent.setBackgroundColor(Color.parseColor("#00A0D1"));

代码示例来源:origin: stackoverflow.com

Toolbar toolbar; // your toolbar
toolbar.setBackgroundColor(newColor); // i don't tested this method. Write if it's not working
toolbar.setTitleTextColor(titleColor); // if toolbar is white set title to black, if toolbar is black set title to white

代码示例来源:origin: net.imagej/ij

static void setColor(int red, int green, int blue, boolean foreground) {
  if (red<0) red=0; if (green<0) green=0; if (blue<0) blue=0; 
  if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;  
  Color c = new Color(red, green, blue);
  if (foreground) {
    Toolbar.setForegroundColor(c);
    ImagePlus img = WindowManager.getCurrentImage();
    if (img!=null)
      img.getProcessor().setColor(c);
  } else
    Toolbar.setBackgroundColor(c);
}

代码示例来源:origin: imagej/ImageJA

static void setColor(int red, int green, int blue, boolean foreground) {
  if (red<0) red=0; if (green<0) green=0; if (blue<0) blue=0; 
  if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;  
  Color c = new Color(red, green, blue);
  if (foreground) {
    Toolbar.setForegroundColor(c);
    ImagePlus img = WindowManager.getCurrentImage();
    if (img!=null)
      img.getProcessor().setColor(c);
  } else
    Toolbar.setBackgroundColor(c);
}

代码示例来源:origin: net.imagej/ij

void setDrawingColor(int x, int y, boolean setBackground) {
  int p = ip.getPixel(x, y);
  int r = (p&0xff0000)>>16;
  int g = (p&0xff00)>>8;
  int b = p&0xff;
  Color c = new Color(r, g, b);
  if (setBackground) {
    Toolbar.setBackgroundColor(c);
    if (Recorder.record)
      Recorder.setBackgroundColor(c);
  } else {
    Toolbar.setForegroundColor(c);
    if (Recorder.record)
      Recorder.setForegroundColor(c);
  }
}

代码示例来源:origin: imagej/ImageJA

void setDrawingColor(int x, int y, boolean setBackground) {
  int p = ip.getPixel(x, y);
  int r = (p&0xff0000)>>16;
  int g = (p&0xff00)>>8;
  int b = p&0xff;
  Color c = new Color(r, g, b);
  if (setBackground) {
    Toolbar.setBackgroundColor(c);
    if (Recorder.record)
      Recorder.setBackgroundColor(c);
  } else {
    Toolbar.setForegroundColor(c);
    if (Recorder.record)
      Recorder.setForegroundColor(c);
  }
}

代码示例来源:origin: net.imagej/ij

void editColor() {
  Color c  = background?Toolbar.getBackgroundColor():Toolbar.getForegroundColor();
  ColorChooser cc = new ColorChooser((background?"Background":"Foreground")+" Color", c, false);
  c = cc.getColor();
  if (background)
    Toolbar.setBackgroundColor(c);
  else
    Toolbar.setForegroundColor(c);
}

代码示例来源:origin: imagej/ImageJA

void editColor() {
  Color c  = background?Toolbar.getBackgroundColor():Toolbar.getForegroundColor();
  ColorChooser cc = new ColorChooser((background?"Background":"Foreground")+" Color", c, false);
  c = cc.getColor();
  if (background)
    Toolbar.setBackgroundColor(c);
  else
    Toolbar.setForegroundColor(c);
}

代码示例来源:origin: net.imagej/imagej-legacy

public void colorOptions(ColorRGB fgColor, ColorRGB bgColor) {
  Toolbar.setForegroundColor(AWTColors.getColor(fgColor));
  Toolbar.setBackgroundColor(AWTColors.getColor(bgColor));
  OptionsChannels options = optionsService.getOptions(OptionsChannels.class);
  options.setLastFgColor(fgColor, false);
  options.setLastBgColor(bgColor, false);
  //options.save(); BDZ - shouldn't be necessary - see OptionsChannels impl
}

代码示例来源:origin: net.imagej/ij

public void itemStateChanged(ItemEvent e) {
  Choice choice = (Choice)e.getSource();
  String item = choice.getSelectedItem();
  Color color = getColor(item, Color.black);
  if (choice==fchoice)
    Toolbar.setForegroundColor(color);
  else if (choice==bchoice)
    Toolbar.setBackgroundColor(color);
  else if (choice==schoice) {
    Roi.setColor(color);
    ImagePlus imp = WindowManager.getCurrentImage();
    if (imp!=null && imp.getRoi()!=null) imp.draw();
    Toolbar.getInstance().repaint();
  }
}

代码示例来源:origin: imagej/ImageJA

public void itemStateChanged(ItemEvent e) {
  Choice choice = (Choice)e.getSource();
  String item = choice.getSelectedItem();
  Color color = getColor(item, Color.black);
  if (choice==fchoice)
    Toolbar.setForegroundColor(color);
  else if (choice==bchoice)
    Toolbar.setBackgroundColor(color);
  else if (choice==schoice) {
    Roi.setColor(color);
    ImagePlus imp = WindowManager.getCurrentImage();
    if (imp!=null && imp.getRoi()!=null) imp.draw();
    Toolbar.getInstance().repaint();
  }
}

相关文章