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


Java ViewGroup.getResources方法代码示例

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


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

示例1: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    TextView view = new TextView(parent.getContext());

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.grid_item_width);
    int height = res.getDimensionPixelSize(R.dimen.grid_item_height);

    view.setLayoutParams(new ViewGroup.LayoutParams(width, height));
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(ContextCompat.getColor(parent.getContext(),
            R.color.default_background));
    view.setTextColor(Color.WHITE);
    view.setGravity(Gravity.CENTER);
    return new ViewHolder(view);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:18,代码来源:GridItemPresenter.java

示例2: createRowViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
    mR = parent.getResources();

    // We create the base class view holder first
    ViewHolder fullWidthViewHolder = (ViewHolder)super.createRowViewHolder(parent);

    // We expand the info view and put it inside the parent fullwidth container
    ViewGroup fullwidthContainer = (ViewGroup)fullWidthViewHolder.getMainContainer();
    View detailsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.androidtv_details_text_only_group, fullwidthContainer, false);
    fullwidthContainer.addView(detailsView);

    fullwidthContainer.setBackgroundColor(mColor);

    return new FullTextRowViewHolder(fullWidthViewHolder, detailsView);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:17,代码来源:FullTextRowPresenter.java

示例3: createRowViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
    mR = parent.getResources();

    // We create the base class view holder first
    FullWidthRowPresenter.ViewHolder fullWidthViewHolder = (FullWidthRowPresenter.ViewHolder)super.createRowViewHolder(parent);

    // We expand the info view and put it inside the parent fullwidth container
    ViewGroup fullwidthContainer = (ViewGroup)fullWidthViewHolder.getMainContainer();
    View detailsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.androidtv_detailled_info_group, fullwidthContainer, false);
    fullwidthContainer.addView(detailsView);

    fullwidthContainer.setBackgroundColor(mColor);

    return new FileDetailsViewHolder(fullWidthViewHolder, detailsView);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:17,代码来源:FileDetailsRowPresenter.java

示例4: createRowViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
    mR = parent.getResources();

    // We create the base class view holder first
    ViewHolder fullWidthViewHolder = (ViewHolder)super.createRowViewHolder(parent);

    // We expand the info view and put it inside the parent fullwidth container
    ViewGroup fullwidthContainer = (ViewGroup)fullWidthViewHolder.getMainContainer();
    View detailsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.leanback_details_plot_and_genres_group, fullwidthContainer, false);
    fullwidthContainer.addView(detailsView);

    fullwidthContainer.setBackgroundColor(mColor);

    return new PlotAndGenresViewHolder(fullWidthViewHolder, detailsView);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:17,代码来源:PlotAndGenresRowPresenter.java

示例5: createRowViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
    mR = parent.getResources();

    // We create the base class view holder first
    ViewHolder fullWidthViewHolder = (ViewHolder)super.createRowViewHolder(parent);

    // We expand the info view and put it inside the parent fullwidth container
    ViewGroup fullwidthContainer = (ViewGroup)fullWidthViewHolder.getMainContainer();
    View detailsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.leanback_details_director_and_cast_group, fullwidthContainer, false);
    fullwidthContainer.addView(detailsView);

    fullwidthContainer.setBackgroundColor(mColor);

    return new CastViewHolder(fullWidthViewHolder, detailsView);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:17,代码来源:CastRowPresenter.java

示例6: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageView imageView = (ImageView) LayoutInflater.from(parent.getContext())
            .inflate(R.layout.lb_fullwidth_details_overview_logo, parent, false);

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.detail_thumb_width);
    int height = res.getDimensionPixelSize(R.dimen.detail_thumb_height);

    if(mSelectedVideo.videoType.equals("episode")) {
        height = res.getDimensionPixelSize(R.dimen.detail_thumb_episode_height);
    }

    imageView.setLayoutParams(new ViewGroup.MarginLayoutParams(width, height));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

    return new ViewHolder(imageView);
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:19,代码来源:VideoDetailsFragment.java

示例7: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageView imageView =
            (ImageView)
                    LayoutInflater.from(parent.getContext())
                            .inflate(
                                    R.layout.lb_fullwidth_details_overview_logo,
                                    parent,
                                    false);

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.detail_thumb_width);
    int height = res.getDimensionPixelSize(R.dimen.detail_thumb_height);
    imageView.setLayoutParams(new ViewGroup.MarginLayoutParams(width, height));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

    return new ViewHolder(imageView);
}
 
开发者ID:googlesamples,项目名称:leanback-assistant,代码行数:19,代码来源:VideoDetailsFragment.java

示例8: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
	ImageView imageView = (ImageView) LayoutInflater.from(parent.getContext())
			.inflate(R.layout.lb_fullwidth_details_overview_logo, parent, false);

	Resources res = parent.getResources();
	int width = res.getDimensionPixelSize(R.dimen.detail_thumb_width);
	int height = res.getDimensionPixelSize(R.dimen.detail_thumb_height);
	imageView.setLayoutParams(new ViewGroup.MarginLayoutParams(width, height));
	imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

	return new ViewHolder(imageView);
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:14,代码来源:EventsDetailsFragment.java

示例9: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageView imageView = (ImageView) LayoutInflater.from(parent.getContext())
            .inflate(R.layout.lb_fullwidth_details_overview_logo, parent, false);

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.detail_thumb_width);
    int height = res.getDimensionPixelSize(R.dimen.detail_thumb_height);
    imageView.setLayoutParams(new ViewGroup.MarginLayoutParams(width, height));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

    return new ViewHolder(imageView);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:14,代码来源:VideoDetailsFragment.java

示例10: createAndAddEditButton

import android.view.ViewGroup; //导入方法依赖的package包/类
private Button createAndAddEditButton(ViewGroup parent) {
    Resources resources = parent.getResources();
    Button view = DualControlLayout.createButtonForLayout(
            parent.getContext(), true, resources.getString(R.string.select), this);
    view.setId(R.id.payments_section);

    LayoutParams params =
            new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    ApiCompatibilityUtils.setMarginStart(params, mLargeSpacing);
    parent.addView(view, params);
    return view;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:PaymentRequestSection.java

示例11: createAndAddChevron

import android.view.ViewGroup; //导入方法依赖的package包/类
private ImageView createAndAddChevron(ViewGroup parent) {
    Resources resources = parent.getResources();
    TintedDrawable chevron = TintedDrawable.constructTintedDrawable(
            resources, R.drawable.ic_expanded, R.color.payments_section_chevron);

    ImageView view = new ImageView(parent.getContext());
    view.setImageDrawable(chevron);

    // Wrap whatever image is passed in.
    LayoutParams params =
            new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    ApiCompatibilityUtils.setMarginStart(params, mLargeSpacing);
    parent.addView(view, params);
    return view;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:PaymentRequestSection.java

示例12: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {

    mDefaultBackgroundColor =
            ContextCompat.getColor(parent.getContext(), R.color.default_background);
    mSelectedBackgroundColor =
            ContextCompat.getColor(parent.getContext(), R.color.selected_background);

    TextView view = new AppCompatTextView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateGridItemBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.grid_item_width);
    int height = res.getDimensionPixelSize(R.dimen.grid_item_height);

    view.setLayoutParams(new ViewGroup.LayoutParams(width, height));
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(ContextCompat.getColor(parent.getContext(),
            R.color.default_background));
    view.setTextColor(Color.WHITE);
    view.setGravity(Gravity.CENTER);
    return new ViewHolder(view);
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:30,代码来源:GridItemPresenter.java

示例13: instantiateItem

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public Object instantiateItem(final ViewGroup container, int position) {
    if(mData != null && mData.size() > position){
        ZoomableDraweeView zoomableDraweeView = null;
        if(mImageViewList != null && mImageViewList.length > position && mImageViewList[position] != null){
            zoomableDraweeView = mImageViewList[position];

        }else{
            zoomableDraweeView = new ZoomableDraweeView(container.getContext());
            zoomableDraweeView.setAllowTouchInterceptionWhileZoomed(true);
            // needed for double tap to zoom
            zoomableDraweeView.setIsLongpressEnabled(false);
            zoomableDraweeView.setSwipeDownListener(mSwipeDownListener);
            final ZoomableDraweeView finalZoomableDraweeView = zoomableDraweeView;
            zoomableDraweeView.setTapListener(new DoubleTapGestureListener(finalZoomableDraweeView){
                @Override
                public boolean onSingleTapConfirmed(MotionEvent e) {
                    if(mItemClickListener != null){
                        mItemClickListener.onClick(finalZoomableDraweeView);
                    }
                    return super.onSingleTapConfirmed(e);
                }
            });
            DraweeController controller = Fresco.newDraweeControllerBuilder()
                    .setUri(mData.get(position % mData.size()))
                    .build();
            zoomableDraweeView.setController(controller);
            GenericDraweeHierarchyBuilder builder =
                    new GenericDraweeHierarchyBuilder(container.getResources());
            GenericDraweeHierarchy hierarchy = builder
                    .setFadeDuration(300).setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
                    .build();
            if(mPlaceholderImageResId > 0){
                hierarchy.setPlaceholderImage(mPlaceholderImageResId, ScalingUtils.ScaleType.FIT_CENTER);
            }
            if(mFailureImageResId > 0){
                hierarchy.setFailureImage(mFailureImageResId, ScalingUtils.ScaleType.FIT_CENTER);
            }
            zoomableDraweeView.setHierarchy(hierarchy);

            mImageViewList[position] = zoomableDraweeView;
        }
        container.addView(zoomableDraweeView);

        return zoomableDraweeView;
    }

    return null;
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:50,代码来源:LargeImageGalleryAdapter.java


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