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


Java ImageView.setLayoutParams方法代码示例

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


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

示例1: ScreenEdgesCalibrationTool

import android.widget.ImageView; //导入方法依赖的package包/类
public ScreenEdgesCalibrationTool(MainActivity _p) 
{
	p = _p;
	img = new ImageView(p);
	img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
	img.setScaleType(ImageView.ScaleType.MATRIX);
	bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate );
	img.setImageBitmap(bmp);
	Matrix m = new Matrix();
	RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
	RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1], 
							Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
	m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
	img.setImageMatrix(m);
	p.getVideoLayout().addView(img);
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:17,代码来源:SettingsMenuMouse.java

示例2: initialize

import android.widget.ImageView; //导入方法依赖的package包/类
private void initialize(Context context) {
    // We only want our ImageView in here. Nothing else is permitted
    removeAllViews();

    image = new ImageView(context);

    LayoutParams imageLayout = new LayoutParams(
            LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);

    image.setLayoutParams(imageLayout);

    // We want to prevent up-scaling the image, but still have it fit within
    // the layout bounds as best as possible.
    image.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    addView(image);
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:18,代码来源:ProfilePictureView.java

示例3: ItemHolder

import android.widget.ImageView; //导入方法依赖的package包/类
public ItemHolder(View itemView) {
    super(itemView);
    int mWidth;
    DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
    mWidth = (metrics.widthPixels) / Common.getNumberOfColms();

    albumName = (TextView) itemView.findViewById(R.id.gridViewTitleText);
    artistName = (TextView) itemView.findViewById(R.id.gridViewSubText);
    albumart = (ImageView) itemView.findViewById(R.id.gridViewImage);


    albumName.setTypeface(TypefaceHelper.getTypeface(itemView.getContext(), TypefaceHelper.FUTURA_BOOK));
    artistName.setTypeface(TypefaceHelper.getTypeface(itemView.getContext(), TypefaceHelper.FUTURA_BOOK));

    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) albumart.getLayoutParams();
    params.width = mWidth;
    params.height = mWidth;
    albumart.setLayoutParams(params);

    mOverFlow = (ImageView) itemView.findViewById(R.id.overflow);
    mOverFlow.setOnClickListener(this);
    itemView.setOnClickListener(this);

}
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:25,代码来源:SubGridViewAdapter.java

示例4: onException

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onException(NestedContainer container, String errCode, String msg) {
  if (TextUtils.equals(errCode, WXRenderErrorCode.WX_NETWORK_ERROR) && container instanceof WXEmbed) {
    final WXEmbed comp = ((WXEmbed)container);
    final ImageView imageView = new ImageView(comp.getContext());
    imageView.setImageResource(R.drawable.error);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ERROR_IMG_WIDTH, ERROR_IMG_HEIGHT);
    layoutParams.gravity = Gravity.CENTER;
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ImageView.ScaleType.FIT_XY);
    imageView.setAdjustViewBounds(true);
    imageView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        imageView.setOnClickListener(null);
        imageView.setEnabled(false);
        comp.loadContent();
      }
    });
    FrameLayout hostView = comp.getHostView();
    hostView.removeAllViews();
    hostView.addView(imageView);
    WXLogUtils.e("WXEmbed", "NetWork failure :" + errCode + ",\n error message :" + msg);
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:26,代码来源:WXEmbed.java

示例5: processLogic

import android.widget.ImageView; //导入方法依赖的package包/类
protected void processLogic() {
    this.mIndicatorIvList = new ArrayList();
    this.mGridViewList = new ArrayList();
    int emotionPageCount = ((MQEmotionUtil.sEmotionKeyArr.length - 1) / 27) + 1;
    LayoutParams indicatorIvLp = new LayoutParams(-2, -2);
    int margin = MQUtils.dip2px(getContext(), 5.0f);
    indicatorIvLp.setMargins(margin, margin, margin, margin);
    for (int i = 0; i < emotionPageCount; i++) {
        ImageView indicatorIv = new ImageView(getContext());
        indicatorIv.setLayoutParams(indicatorIvLp);
        indicatorIv.setImageResource(R.drawable.mq_selector_emotion_indicator);
        indicatorIv.setEnabled(false);
        this.mIndicatorIvList.add(indicatorIv);
        this.mIndicatorLl.addView(indicatorIv);
        this.mGridViewList.add(getGridView(i));
    }
    ((ImageView) this.mIndicatorIvList.get(0)).setEnabled(true);
    this.mContentVp.setAdapter(new EmotionPagerAdapter());
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:MQEmotionKeyboardLayout.java

示例6: resetImgWidthHeight

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * reset img width and height
 * @author leibing
 * @createTime 2017/2/28
 * @lastModify 2017/2/28
 * @param imageView
 * @return
 */
public ImageView resetImgWidthHeight(ImageView imageView, int originWidth, int originHeight,
                                     int targetWidth){
    // get img layout
    ViewGroup.LayoutParams para = imageView.getLayoutParams();
    // target height
    int targetHeight = (originHeight * targetWidth) / originWidth;
    // modify layout width and height
    // modify width
    para.width = targetWidth;
    // modify height
    para.height = targetHeight;
    // reset layout params
    imageView.setLayoutParams(para);

    return imageView;
}
 
开发者ID:leibing8912,项目名称:JkImageLoader,代码行数:25,代码来源:JkImageLoader.java

示例7: resetIndicator

import android.widget.ImageView; //导入方法依赖的package包/类
private void resetIndicator(int currentIndex) {
    indicator.removeAllViews();
    indicatorInside.removeAllViews();
    for (int i = 0; i < count; i++) {
        ImageView imageView = new ImageView(getContext());
        imageView.setScaleType(ScaleType.CENTER_CROP);
        if (i == currentIndex) {
            imageView.setImageResource(mIndicatorSelectedResId);
        } else {
            imageView.setImageResource(mIndicatorUnselectedResId);
        }
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        lp.setMargins(mIndicatorMargin, 0, mIndicatorMargin, 0);
        imageView.setLayoutParams(lp);
        if (mBannerStyle == BannerStyle.CIRCLE_INDICATOR || mBannerStyle == BannerStyle.CIRCLE_INDICATOR_TITLE) {
            indicator.addView(imageView, lp);
        } else if (mBannerStyle == BannerStyle.CIRCLE_INDICATOR_TITLE_INSIDE) {
            indicatorInside.addView(imageView, lp);
        }
    }
}
 
开发者ID:lany192,项目名称:BannerView,代码行数:22,代码来源:BannerView.java

示例8: initViews

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void initViews() {
    mRollPagerView = (RollPagerView) findViewById(R.id.home_rollPagerView);

    mRecyclerView = (RecyclerView) findViewById(R.id.home_recyclerView);


    ImageView imageView = new ImageView(mActivity);
    imageView.setAdjustViewBounds(true);
    imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
 
开发者ID:ymqq,项目名称:CommonFramework,代码行数:12,代码来源:MainTabHomeFragment.java

示例9: createSelectedColorView

import android.widget.ImageView; //导入方法依赖的package包/类
private View createSelectedColorView(ImageView selectedView) {
    final ImageView fakeImageView = new CircleImageView(
        getContext(), null, R.attr.colorStyle);

    fakeImageView.setImageDrawable(selectedView.getDrawable());
    fakeImageView.setLayoutParams(SelectedParamsFactory.startColorParams(selectedView));
    return fakeImageView;
}
 
开发者ID:saulmm,项目名称:From-design-to-Android-part1,代码行数:9,代码来源:OrderDialogFragment.java

示例10: PageIndicator

import android.widget.ImageView; //导入方法依赖的package包/类
public PageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PageIndicator);
    normalIndicator = a.getResourceId(R.styleable.PageIndicator_normal_indicator,
            R.drawable.shape_ring_white);
    selectedIndicator = a.getResourceId(R.styleable.PageIndicator_selected_indicator,
            R.drawable.shape_point_white);
    leftMargin = a.getDimension(R.styleable.PageIndicator_leftMargin, dip2px(10));
    a.recycle();

    LayoutParams params = new LayoutParams
            (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    llIndicators = new LinearLayout(context);
    llIndicators.setLayoutParams(params);
    llIndicators.setOrientation(LinearLayout.HORIZONTAL);

    indicator = new ImageView(context);
    LayoutParams params1 = new LayoutParams
            (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    indicator.setLayoutParams(params1);
    indicator.setImageResource(selectedIndicator);//默认使用白色实心点

    this.addView(llIndicators);
    this.addView(indicator);
}
 
开发者ID:BittleDragon,项目名称:PageIndicator,代码行数:28,代码来源:PageIndicator.java

示例11: onCreateView

import android.widget.ImageView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    int imgRes = getArguments().getInt(IMG_RESOURCE);
    ImageView imageView = new ImageView(getContext());
    ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ImageView.ScaleType.FIT_XY);
    imageView.setImageResource(imgRes);
    return imageView;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:PicFragment.java

示例12: initAdimgs

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 初始化图片
 *
 * @param urls
 */
private void initAdimgs(String[] urls) {
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    int length = urls.length + 2;
    mImageViews = new ImageView[length];
    for (int i = 0; i < length; i++) {
        ImageView imageView = new ImageView(context);
        imageView.setLayoutParams(params);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        mImageViews[i] = imageView;
    }
    setImg(length, urls);
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:18,代码来源:AdViewpagerUtil.java

示例13: setIconSizeAt

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * set item ImageView size which at position
 *
 * @param position position start from 0
 * @param width    in dp
 * @param height   in dp
 */
public void setIconSizeAt(int position, float width, float height) {
    ImageView icon = getIconAt(position);
    // update size
    ViewGroup.LayoutParams layoutParams = icon.getLayoutParams();
    layoutParams.width = dp2px(getContext(), width);
    layoutParams.height = dp2px(getContext(), height);
    icon.setLayoutParams(layoutParams);

    mMenuView.updateMenuView();
}
 
开发者ID:wheat7,项目名称:Cashew,代码行数:18,代码来源:BottomNavigationViewEx.java

示例14: ActionBarMenuItem

import android.widget.ImageView; //导入方法依赖的package包/类
public ActionBarMenuItem(Context context, ActionBarMenu menu, int backgroundColor) {
    super(context);
    if (backgroundColor != 0) {
        setBackgroundDrawable(Theme.createBarSelectorDrawable(backgroundColor));
    }
    parentMenu = menu;

    iconView = new ImageView(context);
    iconView.setScaleType(ImageView.ScaleType.CENTER);
    addView(iconView);
    LayoutParams layoutParams = (LayoutParams) iconView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    iconView.setLayoutParams(layoutParams);
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:16,代码来源:ActionBarMenuItem.java

示例15: updateTabStyles

import android.widget.ImageView; //导入方法依赖的package包/类
private void updateTabStyles() {
        for (int i = 0; i < mTabCount; i++) {
            View tabView = mTabsContainer.getChildAt(i);
            tabView.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
            TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title);
            boolean selected = i == mCurrentTab;
            tv_tab_title.setTextColor(selected ? mTextSelectColor : mTextUnselectColor);
            tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextsize);
//            tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
            if (mTextAllCaps) {
                tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase());
            }

            if (mTextBold == TEXT_BOLD_BOTH) {
                tv_tab_title.getPaint().setFakeBoldText(true);
            } else if (mTextBold == TEXT_BOLD_NONE) {
                tv_tab_title.getPaint().setFakeBoldText(false);
            }

            ImageView iv_tab_icon = (ImageView) tabView.findViewById(R.id.iv_tab_icon);
            if (mIconVisible) {
                iv_tab_icon.setVisibility(View.VISIBLE);
//                CustomTabEntity tabEntity = mTabEntitys.get(i);
                iv_tab_icon.setColorFilter(selected ? selectIconColor : unSelectIconColor);
                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                        mIconWidth <= 0 ? LinearLayout.LayoutParams.WRAP_CONTENT : (int) mIconWidth,
                        mIconHeight <= 0 ? LinearLayout.LayoutParams.WRAP_CONTENT : (int) mIconHeight);
                if (mIconGravity == Gravity.LEFT) {
                    lp.rightMargin = (int) mIconMargin;
                } else if (mIconGravity == Gravity.RIGHT) {
                    lp.leftMargin = (int) mIconMargin;
                } else if (mIconGravity == Gravity.BOTTOM) {
                    lp.topMargin = (int) mIconMargin;
                } else {
                    lp.bottomMargin = (int) mIconMargin;
                }

                iv_tab_icon.setLayoutParams(lp);
            } else {
                iv_tab_icon.setVisibility(View.GONE);
            }
        }
    }
 
开发者ID:Blankeer,项目名称:MDWechat,代码行数:44,代码来源:CommonTabLayout.java


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