android.widget.Button.getRight()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中android.widget.Button.getRight()方法的一些代码示例,展示了Button.getRight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getRight()方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:getRight

Button.getRight介绍

暂无

代码示例

代码示例来源:origin: AndBible/and-bible

/** calculate button position relative to this table because MotionEvents are relative to this table
 */
private void recordButtonPositions() {
  for (ButtonInfo buttonInfo : buttonInfoList) {
    
    // get position of button within row
    Button button = buttonInfo.button;
    TableRow tableRow = (TableRow)button.getParent();
    
    buttonInfo.left += button.getLeft()+tableRow.getLeft();
    buttonInfo.top += button.getTop()+tableRow.getTop();
    buttonInfo.right += button.getRight()+tableRow.getLeft();
    buttonInfo.bottom += button.getBottom()+tableRow.getTop();
  }
  
  // calculate offset of 2 button heights so users can see the buttons surrounding the current button pressed
  if (buttonInfoList.size()>0) {
    ButtonInfo but1 = buttonInfoList.get(0);
    mPreviewOffset = but1.top - but1.bottom;
  }
}
/**

代码示例来源:origin: THEONE10211024/ApiDemos

/**
 * The name 'test preconditions' is a convention to signal that if this
 * test doesn't pass, the test case was not set up properly and it might
 * explain any and all failures in other tests.  This is not guaranteed
 * to run before other tests, as junit uses reflection to find the tests.
 */
@SmallTest
public void testPreconditions() {
  assertNotNull(mLeftButton);
  assertTrue("center button should be right of left button",
      mLeftButton.getRight() < mCenterButton.getLeft());
  assertTrue("right button should be right of center button",
      mCenterButton.getRight() < mRightButton.getLeft());
}

代码示例来源:origin: qiubiteme/android_api_demos

/**
 * The name 'test preconditions' is a convention to signal that if this
 * test doesn't pass, the test case was not set up properly and it might
 * explain any and all failures in other tests.  This is not guaranteed
 * to run before other tests, as junit uses reflection to find the tests.
 */
@SmallTest
public void testPreconditions() {
  assertNotNull(mLeftButton);
  assertTrue("center button should be right of left button",
      mLeftButton.getRight() < mCenterButton.getLeft());
  assertTrue("right button should be right of center button",
      mCenterButton.getRight() < mRightButton.getLeft());
}

代码示例来源:origin: THEONE10211024/ApiDemos

/**
 * The name 'test preconditions' is a convention to signal that if this
 * test doesn't pass, the test case was not set up properly and it might
 * explain any and all failures in other tests.  This is not guaranteed
 * to run before other tests, as junit uses reflection to find the tests.
 */
@MediumTest
public void testPreconditions() {
  assertTrue("center button should be right of left button",
      mLeftButton.getRight() < mCenterButton.getLeft());
  assertTrue("right button should be right of center button",
      mCenterButton.getRight() < mRightButton.getLeft());
  assertTrue("left button should be focused", mLeftButton.isFocused());
}

代码示例来源:origin: qiubiteme/android_api_demos

/**
 * The name 'test preconditions' is a convention to signal that if this
 * test doesn't pass, the test case was not set up properly and it might
 * explain any and all failures in other tests.  This is not guaranteed
 * to run before other tests, as junit uses reflection to find the tests.
 */
@MediumTest
public void testPreconditions() {
  assertTrue("center button should be right of left button",
      mLeftButton.getRight() < mCenterButton.getLeft());
  assertTrue("right button should be right of center button",
      mCenterButton.getRight() < mRightButton.getLeft());
  assertTrue("left button should be focused", mLeftButton.isFocused());
}

相关文章

微信公众号

最新文章

更多

Button类方法