当前位置: 首页>>代码示例>>Java>>正文


Java GridView.setPadding方法代码示例

本文整理汇总了Java中android.widget.GridView.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java GridView.setPadding方法的具体用法?Java GridView.setPadding怎么用?Java GridView.setPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.GridView的用法示例。


在下文中一共展示了GridView.setPadding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEmotionGridView

import android.widget.GridView; //导入方法依赖的package包/类
/**
 * 创建显示表情的GridView
 */
private GridView createEmotionGridView(List<String> emotionNames, int gvWidth, int padding, int itemWidth, int gvHeight) {
    // 创建GridView
    GridView gv = new GridView(getActivity());
    //设置点击背景透明
    gv.setSelector(android.R.color.transparent);
    //设置7列
    gv.setNumColumns(7);
    gv.setPadding(padding, padding, padding, padding);
    gv.setHorizontalSpacing(padding);
    gv.setVerticalSpacing(padding * 2);
    //设置GridView的宽高
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(gvWidth, gvHeight);
    gv.setLayoutParams(params);
    // 给GridView设置表情图片
    EmotionGridViewAdapter adapter = new EmotionGridViewAdapter(getActivity(), emotionNames, itemWidth,emotion_map_type);
    gv.setAdapter(adapter);
    //设置全局点击事件
    gv.setOnItemClickListener(GlobalOnItemClickManagerUtils.getInstance().getOnItemClickListener(getActivity(),emotion_map_type));
    return gv;
}
 
开发者ID:SiberiaDante,项目名称:EmotionApp,代码行数:24,代码来源:EmotionComplateFragment.java

示例2: getViewPagerItem

import android.widget.GridView; //导入方法依赖的package包/类
private GridView getViewPagerItem(final int index) {
    GridView gridView = new GridView(_context);
    gridView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    gridView.setNumColumns(4);
    gridView.setVerticalScrollBarEnabled(false);
    gridView.setHorizontalScrollBarEnabled(false);
    gridView.setPadding(8, 8, 8, 0);
    gridView.setVerticalSpacing(20);
    gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));

    gridView.setAdapter(new YayaEmoGridViewAdapter(_context,
            getGridViewData(index)));
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            int start = index * SysConstant.yayaPageSize;
            onEmoGridViewItemClick.onItemClick(position + start, index);
        }
    });
    return gridView;
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:24,代码来源:YayaEmoGridView.java

示例3: getViewPagerItem

import android.widget.GridView; //导入方法依赖的package包/类
private GridView getViewPagerItem(final int index) {
    GridView gridView = new GridView(_context);
    gridView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    gridView.setNumColumns(7);
    gridView.setVerticalScrollBarEnabled(false);
    gridView.setHorizontalScrollBarEnabled(false);
    gridView.setPadding(8, 8, 8, 0);
    gridView.setVerticalSpacing(CommonUtil.getElementSzie(_context) / 2
            + CommonUtil.getElementSzie(_context) / 3);
    // gridView.setVerticalSpacing(30);
    gridView.setBackgroundColor(Color.TRANSPARENT);
    gridView.setAdapter(new EmoGridViewAdapter(_context,
            getGridViewData(index)));
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            int start = index * (SysConstant.pageSize - 1);
            onEmoGridViewItemClick.onItemClick(position + start, index);
        }
    });
    return gridView;
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:25,代码来源:EmoGridView.java


注:本文中的android.widget.GridView.setPadding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。