android.widget.GridView.setBackgroundColor()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(166)

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

GridView.setBackgroundColor介绍

暂无

代码示例

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

GridView gv = findViewById(R.id.my_grid_view);
gv.setBackgroundColor(Color.WHITE);
gv.setVerticalSpacing(1);
gv.setHorizontalSpacing(1);

代码示例来源:origin: HenriDellal/emerald

private static void initAppsGrid(GridView grid, SharedPreferences options) {
  grid.setBackgroundColor(options.getInt(Keys.APPS_WINDOW_BACKGROUND, 0));
  if (options.getBoolean(Keys.STACK_FROM_BOTTOM, false)) {
    grid.setStackFromBottom(true);
  }
  if (options.getBoolean(Keys.TILE, true)) {
    grid.setNumColumns(GridView.AUTO_FIT);
  }
  
  if (options.getBoolean(Keys.SCROLLBAR, false)) {
    setFastScroll(grid);
  }
}

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

GridView gv = findViewById(R.id.my_grid_view);
gv.setBackgroundColor(Color.WHITE);
gv.setVerticalSpacing(1);
gv.setHorizontalSpacing(1);

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

GridView grid = new GridView(this);  
grid.setId(215236);  
grid.setLayoutParams(new GridView.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));  
grid.setBackgroundColor(Color.WHITE);  
grid.setColumnWidth(GridView.AUTO_FIT);  
grid.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);

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

GridView gv = new GridView(context);
gv.setId(999999);
gv.setLayoutParams(new    
GridView.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
gv.setBackgroundColor(Color.GREEN);
gv.setNumColumns(3);
gv.setColumnWidth(GridView.AUTO_FIT);
gv.setVerticalSpacing(5);
gv.setHorizontalSpacing(5);
gv.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
gv.setGravity(Gravity.CENTER);

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

GridView grid = new GridView(this);
 grid.setId(ViewIdentification.getId());
 grid.setLayoutParams(new GridView.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
 grid.setBackgroundColor(Color.WHITE);
 grid.setNumColumns(3);
 grid.setColumnWidth(GridView.AUTO_FIT);
 grid.setVerticalSpacing(5);
 grid.setHorizontalSpacing(5);
 grid.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);

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

gridview.setNumColumns(7);
gridview.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
gridview.setBackgroundColor(Color.BLACK);
gridview.setAdapter(new CalendarMonthAdapter(this, mMonth, mYear));

代码示例来源:origin: freedom10086/Ruisi

private void init() {
  String[] colors = mContext.getResources().getStringArray(R.array.color_list);
  for (int i = 0; i < colors.length; i++) {
    if (colorDatas == null) {
      colorDatas = new String[colors.length][2];
    }
    colorDatas[i][0] = colors[i].split(",")[0];
    colorDatas[i][1] = colors[i].split(",")[1];
  }
  gridView = new GridView(mContext);
  gridView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  gridView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.white));
  gridView.setNumColumns(8);
  gridView.setPadding(DimenUtils.dip2px(mContext, 8), DimenUtils.dip2px(mContext, 12), DimenUtils.dip2px(mContext, 8), DimenUtils.dip2px(mContext, 12));
  gridView.setGravity(Gravity.CENTER);
  gridView.setHorizontalSpacing(DimenUtils.dip2px(mContext, 4));
  gridView.setVerticalSpacing(DimenUtils.dip2px(mContext, 12));
  gridView.setOnItemClickListener(this);
  setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
  setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
  setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.rec_solid_primary_bg));
  setFocusable(true);
  setContentView(gridView);
  adapter = new MyAdapter();
  gridView.setAdapter(adapter);
}

代码示例来源:origin: nomanr/WeekCalendar

daysName.setBackgroundColor(typedArray.getColor(R.styleable
    .WeekCalendar_weekBackgroundColor, ContextCompat.getColor(getContext(), R
    .color.colorPrimary)));

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

addView(gv);
gv.setBackgroundColor(0xffffffff);
gv.setColumnWidth(50);
gv.setNumColumns(GridView.AUTO_FIT);

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

mGrid.setHorizontalSpacing(0);
mGrid.setStretchMode(GridView.NO_STRETCH);
mGrid.setBackgroundColor(Color.rgb(100, 10, 10));
((RelativeLayout)findViewById(R.id.rootview)).addView(mGrid, params);

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

grid = new GridView(mActivity);
grid.setLayoutParams(new GridView.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
grid.setBackgroundColor(Color.WHITE);
grid.setNumColumns(2);
grid.setColumnWidth(GridView.AUTO_FIT);

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

addView(gv);
gv.setBackgroundColor(0xffffffff);
gv.setColumnWidth(50);
gv.setNumColumns(GridView.AUTO_FIT);

相关文章

GridView类方法