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