當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.setX方法代碼示例

本文整理匯總了Java中android.widget.ImageView.setX方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setX方法的具體用法?Java ImageView.setX怎麽用?Java ImageView.setX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setX方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initExpression

import android.widget.ImageView; //導入方法依賴的package包/類
private void initExpression() {

        int dp80 = (int) getResources().getDimension(R.dimen.dp80);
        int dp10 = (int) getResources().getDimension(R.dimen.dp10);
        for (int x=0; x<expressions.length; x++){
            ImageView imageView = new ImageView(this);
            imageView.setPadding(dp10, dp10, dp10, dp10);
            final int result = expressions[x];
            imageView.setImageResource(result);
            imageView.setLayoutParams(new ViewGroup.LayoutParams(windowWidth /4, dp80));
            imageView.setX(x%4* windowWidth /4);
            imageView.setY(x/4* dp80);
            imageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    rl_expression.setVisibility(View.GONE);
                    iv_icon.setImageResource(R.mipmap.icon);
                    addExpressionToWindow(result);
                }
            });
            rl_expression.addView(imageView);
        }
    }
 
開發者ID:Zhaoss,項目名稱:WeiXinRecordedDemo,代碼行數:24,代碼來源:EditVideoActivity.java

示例2: initExpression

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * 初始化表情
 */
private void initExpression() {

    int dp80 = (int) getResources().getDimension(R.dimen.dp80);
    int dp10 = (int) getResources().getDimension(R.dimen.dp10);
    for (int x=0; x<expressions.length; x++){
        ImageView imageView = new ImageView(this);
        imageView.setPadding(dp10, dp10, dp10, dp10);
        final int result = expressions[x];
        imageView.setImageResource(result);
        imageView.setLayoutParams(new ViewGroup.LayoutParams(windowWidth /4, dp80));
        imageView.setX(x%4* windowWidth /4);
        imageView.setY(x/4* dp80);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                rl_expression.setVisibility(View.GONE);
                iv_icon.setImageResource(R.mipmap.icon);
                addExpressionToWindow(result);
            }
        });
        rl_expression.addView(imageView);
    }
}
 
開發者ID:Zhaoss,項目名稱:WeiXinRecordedDemo,代碼行數:27,代碼來源:EditVideoActivity.java

示例3: getImageView

import android.widget.ImageView; //導入方法依賴的package包/類
private ImageView getImageView(int x, int y) {
    ImageView imageView = new ImageView(context);
    LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    imageView.setLayoutParams(layoutParams);
    imageView.setImageResource(R.drawable.circle);
    imageView.setX(x);
    imageView.setY(y);
    imageView.setOnTouchListener(new TouchListenerImpl());
    return imageView;
}
 
開發者ID:mohammedirfan655,項目名稱:document-scanner,代碼行數:11,代碼來源:PolygonView.java

示例4: addTrainToScreen

import android.widget.ImageView; //導入方法依賴的package包/類
private void addTrainToScreen(Rect trainRect) {
    rootView = new FrameLayout(this);
    engineView = addTrain(trainRect, TrainView.ENGINE, rootView);
    for (int i = 0; i < NUMBER_OF_CARS; i++) {
        carsView.add(addTrain(trainRect, TrainView.CAR, rootView));
    }

    rootView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            fadeOutActivity();
        }
    });

    float iconToWidthFactor = 0.34f;
    ImageView startRoof = new ImageView(this);
    startRoof.setImageResource(R.drawable.long_start_point_roof);
    int trainRectSize = (int) (trainRect.width() * (1f - iconToWidthFactor));
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(trainRectSize, trainRectSize);
    startRoof.setX(trainRect.left + trainRect.width() * iconToWidthFactor / 2 - 15);
    startRoof.setY(trainRect.top + trainRect.width() * iconToWidthFactor / 2);
    rootView.addView(startRoof, lp);

    startRoof.setAlpha(0f);
    startRoof.animate()
            .alpha(1f)
            .setInterpolator(new DecelerateInterpolator())
            .setDuration(500)
            .start();

    setContentView(rootView);
}
 
開發者ID:nirhart,項目名稱:shortrain,代碼行數:33,代碼來源:TrainActionActivity.java

示例5: songSliderThumb

import android.widget.ImageView; //導入方法依賴的package包/類
public songSliderThumb(Context context, int width, int height,int ID) {
    super(context, width, height);
    this.ID = ID;
    setBackgroundColor(0x0000000);
    //SongSliderImg = new songSliderImg(width,height,0,0);
    RaidiusSqure = new radiusSqure(width,height,0,0,width*0.1f);
    RaidiusSqure.setColor(0xFFFFFFFF);

    name = textImg.getFMText(getContext(),"DEMO", Ui.cd.getHt(16));

    back = thumbBack.getFMview(getContext(),false);
    back.setSize(width - Ui.cd.getHt(2),height - Ui.cd.getHt(2));
    back.setX(Ui.cd.getHt(1));
    back.setY(Ui.cd.getHt(1));
    back.setClickable(false);
    addView(back);

    Iv = new ImageView(context){
        @Override
        protected void onDraw(Canvas canvas) {
            canvas.clipPath(back.img.mask);
            super.onDraw(canvas);
        }
    };
    Iv.setLayoutParams(new FrameLayout.LayoutParams(width - Ui.cd.getHt(2),height - Ui.cd.getHt(2)));
     addView(Iv);
    Iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
    Iv.setBackgroundColor(0x00FFFFFF);
    Iv.setX(Ui.cd.getHt(1));
    Iv.setY(Ui.cd.getHt(1));
    //setImg("3.png");

    ring = thumbRing.getFMview(getContext(),false);
    ring.setSize(width,height);
    ring.setClickable(false);
    addView(ring);
    if(android.os.Build.VERSION.SDK_INT <= 18){
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

   // addView(name);
}
 
開發者ID:KishanV,項目名稱:Android-Music-Player,代碼行數:43,代碼來源:songSliderThumb.java


注:本文中的android.widget.ImageView.setX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。