本文整理了Java中com.extjs.gxt.ui.client.widget.button.Button.getWidth()
方法的一些代码示例,展示了Button.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getWidth()
方法的具体详情如下:
包路径:com.extjs.gxt.ui.client.widget.button.Button
类名称:Button
方法名:getWidth
暂无
代码示例来源:origin: stackoverflow.com
public void onClick(View view) {
Button toMove = (Button) findViewById(R.id.button_test2);
Button toMove2 = (Button) findViewById(R.id.button_test3);
TranslateAnimation anim = new TranslateAnimation(0, -toMove
.getWidth(), 0, 0);
anim.setFillAfter(true);
anim.setDuration(1000);
TranslateAnimation anim2 = new TranslateAnimation(0, -toMove
.getWidth(), 0, 0);
anim2.setFillAfter(true);
anim2.setDuration(1000);
//THERE IS ONE MORE TRICK
toMove.setAnimation(anim);
toMove2.setAnimation(anim2);
}
代码示例来源:origin: stackoverflow.com
Button textView02 = (Button) findViewById(R.id.textView02);
LinearLayout target = (LinearLayout) findViewById(R.id.target);
int width = textView02.getWidth();
ObjectAnimator.ofFloat(target, "translationX", 0, -width).setDuration(1000).start();
代码示例来源:origin: stackoverflow.com
Button button= (Button ) findViewById(R.id.button);
button.post(new Runnable() {
@Override
public void run() {
Log.e("",""+button.getHeight()+" "+button.getWidth());
}
});
代码示例来源:origin: com.extjs/gxt
@Override
protected void onResize(int width, int height) {
super.onResize(width, height);
input.setWidth(width - button.getWidth() - buttonOffset, true);
}
}
代码示例来源:origin: stackoverflow.com
final LinearLayout nodesImages = (LinearLayout) findViewById(R.id.nodesImages);
//using addOnGlobalLayoutListener to make sure layout is happened.
nodesImages.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
//Remove the listener before proceeding
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
nodesImages.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} else {
nodesImages.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
Button node1 = (Button)findViewById(R.id.node1);
int[] loc1 = new int[2];
node1.getLocationInWindow(loc1);//loc1[0] is x and loc1[1] is y
//for more information about this method, in Android Studio, just right-click -> Go To -> Declaration
Button node2 = (Button)findViewById(R.id.node2);
int[] loc2 = new int[2];
node2.getLocationInWindow(loc2);
View v = new View(getApplication());
v.setLayoutParams(new ViewGroup.LayoutParams(loc2[0]-loc1[0]-node1.getWidth(),dpToPx(2)));//dpToPx(20 + 20), dpToPx(2)));
v.setBackgroundColor(Color.BLACK);
nodesImages.addView(v);
v.setTranslationY(-dpToPx(30+20+20)-dpToPx(20+30/2));
v.setTranslationX(dpToPx(20+30));
}
}
);
代码示例来源:origin: stackoverflow.com
Button b;
int x1 = b.getX();
int x2 = x1 + b.getWidth();
int y1 = b.getY();
int y2 = y1 + b.getHeight();
代码示例来源:origin: stackoverflow.com
public class YourController implements Initializable {
@FXML HBox mHBox;
@FXML Button mButton;
@Override
public void initialize(final URL paramURL, final ResourceBundle paramResourceBundle) {
Platform.runLater(new Runnable() { public void run() {
double w0 = mHBox.getWidth();
double w1 = mButton.getWidth();
double h0 = mHBox.getHeight();
double size = Math.min(w0-w1, h0);
Canvas canvas = new Canvas(size, size);
mHBox.getChildren().add(0, canvas);
}});
}
}
代码示例来源:origin: stackoverflow.com
scale = (float) (btn.getHeight() * fitFactor) / imgHeight;
} else { //top or bottom -> scale width
scale = (float) (btn.getWidth() * fitFactor) / imgWidth;
代码示例来源:origin: stackoverflow.com
int y = event.getY();
if(x >= button.getX() && x <= (button.getX()+button.getWidth() && y >= button.getY() && y <= (button.getY()+button.getHeight()){
内容来源于网络,如有侵权,请联系作者删除!