本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}