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


Java GridView.LayoutParams方法代码示例

本文整理汇总了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());
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:ImageGridFragment.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:ImageGridFragment.java

示例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();
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:16,代码来源:ImageGridAdapter.java

示例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;
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:34,代码来源:ImageGridAdapter.java

示例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);
}
 
开发者ID:Sugarya,项目名称:SugarPhotoPicker,代码行数:8,代码来源:ImageGridAdapter.java

示例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;
}
 
开发者ID:Sugarya,项目名称:SugarPhotoPicker,代码行数:33,代码来源:ImageGridAdapter.java

示例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());
    }
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:14,代码来源:ImageGridFragment.java

示例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();
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:17,代码来源:ImageGridFragment.java

示例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;
}
 
开发者ID:HK-SHAO,项目名称:DarkCalculator,代码行数:42,代码来源:GridViewAdapter.java

示例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);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:7,代码来源:ImageGridAdapter.java

示例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();
}
 
开发者ID:Sugarya,项目名称:SugarPhotoPicker,代码行数:17,代码来源:ImageGridAdapter.java


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