Java Code Examples for android.widget.ImageView.setY()

The following are Jave code examples for showing how to use setY() of the android.widget.ImageView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: GitHub   File: GuidePageActivity2.java   View Source Code Vote up 8 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    r = (int)Math.sqrt(screenW * screenW + screenH * screenH) + 10;

    ImageView earth = (ImageView) findViewById(R.id.earth);
    targetPlanet = (ImageView) findViewById(R.id.planet_target);
    loginLayout = findViewById(R.id.login_layout);

    earth.setY(screenH / 2);
    targetPlanet.setY(-screenH / 2 - screenW / 2);
    targetPlanet.setScaleX(0.25f);
    targetPlanet.setScaleY(0.25f);

    wowo.addTemporarilyInvisibleViews(0, earth, findViewById(R.id.cloud_blue), findViewById(R.id.cloud_red));
    wowo.addTemporarilyInvisibleViews(0, targetPlanet);
    wowo.addTemporarilyInvisibleViews(2, loginLayout, findViewById(R.id.button));
}
 
Example 2
Project: WeiXinRecordedDemo   File: EditVideoActivity.java   View Source Code Vote up 7 votes
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);
        }
    }
 
Example 3
Project: WeiXinRecordedDemo   File: EditVideoActivity.java   View Source Code Vote up 7 votes
/**
 * 初始化表情
 */
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);
    }
}
 
Example 4
Project: document-scanner   File: PolygonView.java   View Source Code Vote up 6 votes
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;
}
 
Example 5
Project: shortrain   File: TrainActionActivity.java   View Source Code Vote up 6 votes
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);
}
 
Example 6
Project: Android-Music-Player   File: imgSlider.java   View Source Code Vote up 6 votes
ImageView creatImg(){
    ImageView top = new ImageView(getContext());
    top.setLayoutParams(new LayoutParams(width,width));
    top.setY(height - width);
    top.setBackgroundColor(0xFF999999);
    top.setScaleType(ImageView.ScaleType.CENTER_CROP);
    return top;
}
 
Example 7
Project: Android-Music-Player   File: songSliderThumb.java   View Source Code Vote up 5 votes
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);
}