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

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

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

GridView.setBackgroundResource介绍

暂无

代码示例

代码示例来源:origin: p-v/FlexibleCalendar

/**
 * Set the background resource for week view
 *
 * @param resourceId
 */
public void setWeekViewBackgroundResource(@DrawableRes int resourceId) {
  this.weekViewBackground = resourceId;
  weekDisplayView.setBackgroundResource(resourceId);
}

代码示例来源:origin: tdscientist/fluidCalendar

/**
 * Set the background resource for week view
 *
 * @param resourceId
 */
public void setWeekViewBackgroundResource(@DrawableRes int resourceId) {
  this.weekViewBackground = resourceId;
  weekDisplayView.setBackgroundResource(resourceId);
}

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

if (getResources().getConfiguration().orientation ==
    Configuration.ORIENTATION_LANDSCAPE)
  gv.setBackgroundResource(R.drawable.main_bg_horiz);
else
  gv.setBackgroundResource(R.drawable.main_bg);

代码示例来源:origin: uncleleonfan/SlidingMenu

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  if (mPos == -1 && savedInstanceState != null)
    mPos = savedInstanceState.getInt("mPos");
  TypedArray imgs = getResources().obtainTypedArray(R.array.birds_img);
  mImgRes = imgs.getResourceId(mPos, -1);
  
  GridView gv = (GridView) inflater.inflate(R.layout.list_grid, null);
  gv.setBackgroundResource(android.R.color.black);
  gv.setAdapter(new GridAdapter());
  gv.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position,
        long id) {
      if (getActivity() == null)
        return;
      ResponsiveUIActivity activity = (ResponsiveUIActivity) getActivity();
      activity.onBirdPressed(mPos);
    }            
  });
  return gv;
}

代码示例来源:origin: werbhelius/Werb

/**
 * 创建显示表情的GridView
 */
private GridView createEmotionGridView(List<String> emotionNames, int gvWidth, int padding, int itemWidth, int gvHeight) {
  // 创建GridView
  GridView gv = new GridView(context);
  gv.setBackgroundResource(R.color.bg_gray);
  gv.setSelector(R.color.transparent);
  gv.setNumColumns(7);
  gv.setPadding(padding, padding, padding, padding);
  gv.setHorizontalSpacing(padding);
  gv.setVerticalSpacing(padding);
  ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(gvWidth, gvHeight);
  gv.setLayoutParams(params);
  // 给GridView设置表情图片
  EmotionGvAdapter adapter = new EmotionGvAdapter(context, emotionNames, itemWidth);
  gv.setAdapter(adapter);
  gv.setOnItemClickListener(this);
  return gv;
}

代码示例来源:origin: tdscientist/fluidCalendar

weekDisplayView.setVerticalSpacing(weekdayVerticalSpacing);
weekDisplayView.setColumnWidth(GridView.STRETCH_COLUMN_WIDTH);
weekDisplayView.setBackgroundResource(weekViewBackground);
weekdayDisplayAdapter = new WeekdayNameDisplayAdapter(getContext(), R.layout.week_header, startDayOfTheWeek);

代码示例来源:origin: p-v/FlexibleCalendar

weekDisplayView.setVerticalSpacing(weekdayVerticalSpacing);
weekDisplayView.setColumnWidth(GridView.STRETCH_COLUMN_WIDTH);
weekDisplayView.setBackgroundResource(weekViewBackground);
weekdayDisplayAdapter = new WeekdayNameDisplayAdapter(getContext(),
    android.R.layout.simple_list_item_1, startDayOfTheWeek);

相关文章

GridView类方法