android.widget.ListView#LayoutParams ( )源码实例Demo

下面列出了android.widget.ListView#LayoutParams ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: CSipSimple   文件: IcsListPopupWindow.java
private void measureScrapChild(View child, int position, int widthMeasureSpec) {
    ListView.LayoutParams p = (ListView.LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0);
        child.setLayoutParams(p);
    }
    //XXX p.viewType = mAdapter.getItemViewType(position);
    //XXX p.forceAdd = true;

    int childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,
            mDropDownList.getPaddingLeft() + mDropDownList.getPaddingRight(), p.width);
    int lpHeight = p.height;
    int childHeightSpec;
    if (lpHeight > 0) {
        childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
    } else {
        childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    }
    child.measure(childWidthSpec, childHeightSpec);
}
 
源代码2 项目: android-apps   文件: IcsListPopupWindow.java
private void measureScrapChild(View child, int position, int widthMeasureSpec) {
    ListView.LayoutParams p = (ListView.LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0);
        child.setLayoutParams(p);
    }
    //XXX p.viewType = mAdapter.getItemViewType(position);
    //XXX p.forceAdd = true;

    int childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,
            mDropDownList.getPaddingLeft() + mDropDownList.getPaddingRight(), p.width);
    int lpHeight = p.height;
    int childHeightSpec;
    if (lpHeight > 0) {
        childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
    } else {
        childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    }
    child.measure(childWidthSpec, childHeightSpec);
}
 
源代码3 项目: zen4android   文件: IcsListPopupWindow.java
private void measureScrapChild(View child, int position, int widthMeasureSpec) {
    ListView.LayoutParams p = (ListView.LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0);
        child.setLayoutParams(p);
    }
    //XXX p.viewType = mAdapter.getItemViewType(position);
    //XXX p.forceAdd = true;

    int childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,
            mDropDownList.getPaddingLeft() + mDropDownList.getPaddingRight(), p.width);
    int lpHeight = p.height;
    int childHeightSpec;
    if (lpHeight > 0) {
        childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
    } else {
        childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    }
    child.measure(childWidthSpec, childHeightSpec);
}
 
源代码4 项目: zhangshangwuda   文件: IcsListPopupWindow.java
private void measureScrapChild(View child, int position, int widthMeasureSpec) {
    ListView.LayoutParams p = (ListView.LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0);
        child.setLayoutParams(p);
    }
    //XXX p.viewType = mAdapter.getItemViewType(position);
    //XXX p.forceAdd = true;

    int childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,
            mDropDownList.getPaddingLeft() + mDropDownList.getPaddingRight(), p.width);
    int lpHeight = p.height;
    int childHeightSpec;
    if (lpHeight > 0) {
        childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
    } else {
        childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    }
    child.measure(childWidthSpec, childHeightSpec);
}
 
private void measureScrapChild(View child, int position, int widthMeasureSpec) {
    ListView.LayoutParams p = (ListView.LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0);
        child.setLayoutParams(p);
    }
    //XXX p.viewType = mAdapter.getItemViewType(position);
    //XXX p.forceAdd = true;

    int childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,
            mDropDownList.getPaddingLeft() + mDropDownList.getPaddingRight(), p.width);
    int lpHeight = p.height;
    int childHeightSpec;
    if (lpHeight > 0) {
        childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
    } else {
        childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    }
    child.measure(childWidthSpec, childHeightSpec);
}
 
源代码6 项目: giffun   文件: ListLayoutAdapter.java
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    FoldersViewHolder holder = null;
    if (convertView == null) {

        convertView = LayoutInflater.from(mContext).inflate(R.layout.list_view_item, parent, false);
        ListView.LayoutParams params = (ListView.LayoutParams) convertView.getLayoutParams();
        params.height = (int) Utils.convertDpToPixels(72.0f, mContext);
        convertView.setLayoutParams(params);

        holder = new FoldersViewHolder();
        holder.fileFolderIcon = convertView.findViewById(R.id.listViewLeftIcon);
        holder.fileFolderSizeText = convertView.findViewById(R.id.listViewSubText);
        holder.fileFolderNameText = convertView.findViewById(R.id.listViewTitleText);
        if (!mFileBrowserView.shouldShowItemSizes()) {
            //Hide the item size TextViews.
            ((View) holder.fileFolderSizeText.getParent()).setVisibility(View.GONE);
            RelativeLayout.LayoutParams titleParams = (RelativeLayout.LayoutParams)
                    holder.fileFolderNameText.getLayoutParams();
            titleParams.addRule(RelativeLayout.CENTER_VERTICAL);
            holder.fileFolderNameText.setLayoutParams(titleParams);
        }

      /*  if (!mFileBrowserView.shouldShowOverflowMenus()) {
            //Hide the overflow menus.
            holder.overflowButton.setVisibility(View.GONE);
        } else {
            holder.overflowButton.setImageResource(R.mipmap.ic_action_overflow_universal);
            holder.overflowButton.setFocusable(false);
            holder.overflowButton.setFocusableInTouchMode(false);
            holder.overflowButton.setOnClickListener(overflowClickListener);

        }*/

        //Hide the icon if we have to.
        if (!mFileBrowserView.shouldShowItemIcons())
            holder.fileFolderIcon.setVisibility(View.GONE);
        else
            holder.fileFolderIcon.setVisibility(View.VISIBLE);

        convertView.setTag(holder);
    } else {
        holder = (FoldersViewHolder) convertView.getTag();
    }

    holder.fileFolderNameText.setText(getNamesList().get(position));
    holder.fileFolderSizeText.setText(getSizesList().get(position));

    /*
     * Set the icon based on whether the item is a folder or a file.
     * Also make sure to set the type of the item as a tag for this
     * row.
     */
    if (mFileBrowserView.shouldShowItemIcons()) {
        if (getTypesList().get(position) == FileBrowserEngine.FOLDER) {
            holder.fileFolderIcon.setImageResource(R.mipmap.icon_folderblue);
            convertView.setTag(R.string.type, FileBrowserEngine.FOLDER);

        } else if (getTypesList().get(position) == FileBrowserEngine.FILE_AUDIO) {
            holder.fileFolderIcon.setImageResource(R.mipmap.icon_mp3);
            convertView.setTag(R.string.type, FileBrowserEngine.FILE_AUDIO);

        } else if (getTypesList().get(position) == FileBrowserEngine.FILE_PICTURE) {
            Glide.with(mContext)
                    .load(getPathsList().get(position))
                    .asBitmap()
                    .placeholder(R.mipmap.icon_png)
                    .into(holder.fileFolderIcon);
            convertView.setTag(R.string.type, FileBrowserEngine.FILE_PICTURE);

        } else if (getTypesList().get(position) == FileBrowserEngine.FILE_VIDEO) {
            holder.fileFolderIcon.setImageResource(R.mipmap.icon_avi);
            convertView.setTag(R.string.type, FileBrowserEngine.FILE_VIDEO);

        } else {
            holder.fileFolderIcon.setImageResource(R.mipmap.icon_default);
            convertView.setTag(R.string.type, FileBrowserEngine.FILE_GENERIC);

        }

    }

    /*
     * We're gonna need a way to keep track of the file/folder path of each row.
     * We'll set the path as the row view's tag.
     */
    convertView.setTag(R.string.path, getPathsList().get(position));

    return convertView;
}
 
源代码7 项目: Mizuu   文件: IdentifyTvShowFragment.java
public ListAdapter(Context context) {
    mContext = context;
    inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mImageViewLayoutParams = new ListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
 
源代码8 项目: Mizuu   文件: IdentifyMovieFragment.java
public ListAdapter(Context context) {
    mContext = context;
    inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mImageViewLayoutParams = new ListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
 
源代码9 项目: Mizuu   文件: IdentifyTvShowEpisodeFragment.java
public ListAdapter(Context context) {
    mContext = context;
    inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mImageViewLayoutParams = new ListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}