本文整理汇总了Java中android.widget.GridView.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java GridView.LayoutParams方法的具体用法?Java GridView.LayoutParams怎么用?Java GridView.LayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.GridView
的用法示例。
在下文中一共展示了GridView.LayoutParams方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageAdapter
import android.widget.GridView; //导入方法依赖的package包/类
public ImageAdapter(Context context) {
super();
mContext = context;
mImageViewLayoutParams = new GridView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
TypedValue tv = new TypedValue();
if (context.getTheme().resolveAttribute(
android.R.attr.actionBarSize, tv, true)) {
mActionBarHeight = TypedValue.complexToDimensionPixelSize(
tv.data, context.getResources().getDisplayMetrics());
}
}
示例2: setItemHeight
import android.widget.GridView; //导入方法依赖的package包/类
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams =
new GridView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mItemHeight);
notifyDataSetChanged();
}
示例3: setItemSize
import android.widget.GridView; //导入方法依赖的package包/类
/**
* 重置每个Column的Size
* @param columnWidth
*/
public void setItemSize(int columnWidth) {
if (mItemSize == columnWidth) {
return;
}
mItemSize = columnWidth;
mItemLayoutParams = new GridView.LayoutParams(mItemSize, mItemSize);
notifyDataSetChanged();
}
示例4: getView
import android.widget.GridView; //导入方法依赖的package包/类
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
int type = getItemViewType(i);
if (type == TYPE_CAMERA) {
view = mInflater.inflate(R.layout.image_picker_list_item_camera, viewGroup, false);
view.setTag(null);
}
else if (type == TYPE_NORMAL) {
ViewHolder holder;
if (view == null) {
view = mInflater.inflate(R.layout.image_picker_list_item_image, viewGroup, false);
holder = new ViewHolder(view);
}
else {
holder = (ViewHolder) view.getTag();
if (holder == null) {
view = mInflater.inflate(R.layout.image_picker_list_item_image, viewGroup, false);
holder = new ViewHolder(view);
}
}
if (holder != null) {
holder.bindData(getItem(i));
}
}
/** Fixed View Size */
GridView.LayoutParams lp = (GridView.LayoutParams) view.getLayoutParams();
if (lp.height != mItemSize) {
view.setLayoutParams(mItemLayoutParams);
}
return view;
}
示例5: ImageGridAdapter
import android.widget.GridView; //导入方法依赖的package包/类
public ImageGridAdapter(Context context, boolean showCamera, int itemSize){
mContext = context;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.showCamera = showCamera;
this.mItemSize = itemSize;
mItemLayoutParams = new GridView.LayoutParams(mItemSize, mItemSize);
}
示例6: getView
import android.widget.GridView; //导入方法依赖的package包/类
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
int type = getItemViewType(i);
if(type == TYPE_CAMERA){
view = mInflater.inflate(R.layout.item_camera, viewGroup, false);
view.setTag(null);
}else if(type == TYPE_NORMAL){
ViewHolde holde;
if(view == null){
view = mInflater.inflate(R.layout.item_select_image, viewGroup, false);
holde = new ViewHolde(view);
}else{
holde = (ViewHolde) view.getTag();
if(holde == null){
view = mInflater.inflate(R.layout.item_select_image, viewGroup, false);
holde = new ViewHolde(view);
}
}
if(holde != null) {
holde.bindData(getItem(i));
}
}
/** Fixed View Size */
GridView.LayoutParams lp = (GridView.LayoutParams) view.getLayoutParams();
if(lp.height != mItemSize){
view.setLayoutParams(mItemLayoutParams);
}
return view;
}
示例7: ImageAdapter
import android.widget.GridView; //导入方法依赖的package包/类
public ImageAdapter(Context context) {
super();
mContext = context;
mImageViewLayoutParams = new GridView.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
// Calculate ActionBar height
TypedValue tv = new TypedValue();
if (context.getTheme().resolveAttribute(
android.R.attr.actionBarSize, tv, true)) {
mActionBarHeight = TypedValue.complexToDimensionPixelSize(
tv.data, context.getResources().getDisplayMetrics());
}
}
示例8: setItemHeight
import android.widget.GridView; //导入方法依赖的package包/类
/**
* Sets the item height. Useful for when we know the column width so the height can be set
* to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams =
new GridView.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageFetcher.setImageSize(height);
notifyDataSetChanged();
}
示例9: getView
import android.widget.GridView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
View view;
if (convertView == null) {
view = LayoutInflater.from(MainActivity.activity).inflate(layoutId, parent, false);
viewHolder = new ViewHolder();
viewHolder.title = (TextView) view.findViewById(R.id.text_item);
if (viceText != null)
viewHolder.vice = (TextView) view.findViewById(R.id.text_vice_item);
view.setTag(viewHolder);
} else {
view = convertView;
viewHolder = (ViewHolder) view.getTag();
}
viewHolder.title.setText(text.get(position));
if (viceText != null) {
viewHolder.vice.setText(viceText.get(position));
}
if (height == 0)
height = gridView.getHeight();
GridView.LayoutParams param = new GridView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
height / rows);
view.setLayoutParams(param);
if (layoutId == R.layout.button_operator) {
if (deleteParam == null)
deleteParam = MainActivity.activity.delete.getLayoutParams();
if (deleteParam.height != height / rows) {
deleteParam.height = height / rows;
MainActivity.activity.delete.setLayoutParams(deleteParam);
}
}
return view;
}
示例10: ImageGridAdapter
import android.widget.GridView; //导入方法依赖的package包/类
public ImageGridAdapter(Context context, boolean showCamera) {
mContext = context;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.showCamera = showCamera;
mItemLayoutParams = new GridView.LayoutParams(GridView.LayoutParams.MATCH_PARENT, GridView.LayoutParams.MATCH_PARENT);
}
示例11: setItemSize
import android.widget.GridView; //导入方法依赖的package包/类
/**
* 重置每个Column的Size
* @param columnWidth
*/
public void setItemSize(int columnWidth) {
if(mItemSize == columnWidth){
return;
}
mItemSize = columnWidth;
mItemLayoutParams = new GridView.LayoutParams(mItemSize, mItemSize);
notifyDataSetChanged();
}