本文整理汇总了Java中android.widget.GridView.setVerticalSpacing方法的典型用法代码示例。如果您正苦于以下问题:Java GridView.setVerticalSpacing方法的具体用法?Java GridView.setVerticalSpacing怎么用?Java GridView.setVerticalSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.GridView
的用法示例。
在下文中一共展示了GridView.setVerticalSpacing方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例4: onCreateView
import android.widget.GridView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
provider = getArguments().getParcelable(ARG_PROVIDER);
String result = getSQLResult(getContext(), provider, getString(R.string.sql_injection));
View rootView = inflater.inflate(R.layout.fragment_details_schema, container, false);
if (getStatus(result)==100){
//TODO add image view
rootView.findViewById(R.id.tv_schema).setVisibility(View.VISIBLE);
} else {
LinearLayout linearLayout = (LinearLayout) rootView.findViewById(R.id.ll);
Map<String, List<List<String>>> resultToMap = parseResultToMap(result);
for (String name: resultToMap.keySet()){
TextView tv = getFilledTextView(getContext(),name);
linearLayout.addView(tv);
GridView grid = new GridView(getContext());
grid.setNumColumns(3);
grid.setHorizontalSpacing(10);
grid.setVerticalSpacing(10);
grid.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
grid.setGravity(View.TEXT_ALIGNMENT_CENTER);
List<List<String>> list = resultToMap.get(name);
grid.setAdapter(new GridAdapter(getContext(),list));
grid.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, list.size()*35)); //TODO: remove int value
linearLayout.addView(grid);
}
}
return rootView;
}
示例5: init
import android.widget.GridView; //导入方法依赖的package包/类
private void init(){
cal = Calendar.getInstance();
base = new RelativeLayout(context);
base.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
base.setMinimumHeight(50);
base.setId(4);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.leftMargin = 16;
params.topMargin = 50;
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
prev = new ImageView(context);
prev.setId(1);
prev.setLayoutParams(params);
prev.setImageResource(R.drawable.navigation_previous_item);
prev.setOnClickListener(this);
base.addView(prev);
params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
params.addRule(RelativeLayout.CENTER_VERTICAL);
month = new TextView(context);
month.setId(2);
month.setLayoutParams(params);
month.setTextAppearance(context, android.R.attr.textAppearanceLarge);
month.setText(cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault())+" "+cal.get(Calendar.YEAR));
month.setTextSize(25);
base.addView(month);
params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.rightMargin = 16;
params.topMargin = 50;
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
next = new ImageView(context);
next.setImageResource(R.drawable.navigation_next_item);
next.setLayoutParams(params);
next.setId(3);
next.setOnClickListener(this);
base.addView(next);
addView(base);
params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.bottomMargin = 20;
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
params.addRule(RelativeLayout.BELOW, base.getId());
calendar = new GridView(context);
calendar.setLayoutParams(params);
calendar.setVerticalSpacing(4);
calendar.setHorizontalSpacing(4);
calendar.setNumColumns(7);
calendar.setChoiceMode(GridView.CHOICE_MODE_SINGLE);
calendar.setDrawSelectorOnTop(true);
calendar.setFocusable(false);
mAdapter = new CalendarAdapter(context,cal);
calendar.setAdapter(mAdapter);
calendar.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return calendarGesture.onTouchEvent(event);
}
});
addView(calendar);
}
示例6: initViews
import android.widget.GridView; //导入方法依赖的package包/类
private void initViews() {
mBtnBack = (Button) findViewById(R.id.btn_puzzle_main_back);
mBtnImage = (Button) findViewById(R.id.btn_puzzle_main_img);
mBtnRestart = (Button) findViewById(R.id.btn_puzzle_main_restart);
//flag是否显示原图
mIsShowImg = false;
mGvPuzzleMainDetail = (GridView) findViewById(
R.id.gv_puzzle_main_detail);
// 设置为N*N显示
mGvPuzzleMainDetail.setNumColumns(TYPE);
RelativeLayout.LayoutParams gridParams = new RelativeLayout.LayoutParams(mPicSelected.getWidth(),mPicSelected.getHeight());
//水平居中
gridParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
//其他格式属性
gridParams.addRule(RelativeLayout.BELOW,R.id.ll_puzzle_main_spinner);
//Grid显示
mGvPuzzleMainDetail.setLayoutParams(gridParams);
mGvPuzzleMainDetail.setHorizontalSpacing(0);
mGvPuzzleMainDetail.setVerticalSpacing(0);
//TV步数
mTvPuzzleMainCounts = (TextView) findViewById(R.id.tv_puzzle_main_counts);
mTvPuzzleMainCounts.setText(""+ COUNT_INDEX);
//Tv计时器
mTvTimer = (TextView) findViewById(R.id.tv_puzzle_main_time);
mTvTimer.setText("0秒");
//添加显示的原图
addImgView();
}