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

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

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

Button.getLocationOnScreen介绍

暂无

代码示例

代码示例来源:origin: ZieIony/Carbon

public Point getLocationOnScreen() {
  int[] outLocation = new int[2];
  super.getLocationOnScreen(outLocation);
  return new Point(outLocation[0], outLocation[1]);
}

代码示例来源:origin: rajeeviiit/AndroidProject

@Override
public void onWindowFocusChanged(boolean hasFocus) {
  int[] location = new int[2];
  Button button = (Button) findViewById(R.id.show_popup);
  // Get the x, y location and store it in the location[] array
  // location[0] = x, location[1] = y.
  button.getLocationOnScreen(location);
  //Initialize the Point with x, and y positions
  p = new Point();
  p.x = location[0];
  p.y = location[1];
}

代码示例来源:origin: stackoverflow.com

button.getLocationOnScreen(location);

代码示例来源:origin: iTimeTraveler/XYStudy

@Override
public void onWindowFocusChanged(boolean hasFocus) {
  super.onWindowFocusChanged(hasFocus);
  //获取一下响应窗口的坐标
  if (hasFocus) {
    responseSquare.getLocationOnScreen(responseLocations);
    ((TextView) findViewById(R.id.markStart)).setText("(" + responseLocations[0] + "," + responseLocations[1] + ")");
    ((TextView) findViewById(R.id.markEnd)).setText( "(" + (responseLocations[0] + responseSquare.getWidth()) + "," + (responseLocations[1] + responseSquare.getHeight()) + ")");
    int[] temp = new int[2];
    eventBtn.getLocationOnScreen(temp);
    eventBtn.setText("Example Button (" + temp[0] + "," + temp[1] + ")");
  }
}

代码示例来源:origin: stackoverflow.com

btn_show.getLocationOnScreen(location);

代码示例来源:origin: r17171709/android_demo

public View a() {
  ArrayList<CalculatorBean> beanArrayList=new ArrayList<>();
  int[] location=new int[2];
  btn_showcase.getLocationOnScreen(location);
  CalculatorBean bean=new CalculatorBean();
  bean.setmCircleCenterX(location[0]+btn_showcase.getMeasuredWidth()/2);
  bean.setmCircleCenterY(location[1]+btn_showcase.getMeasuredHeight()/2);
  bean.setmCircleRadius(150);
  bean.setmFocusShape(FocusShape.CIRCLE);
  beanArrayList.add(bean);
  View view= LayoutInflater.from(MainActivity.this).inflate(R.layout.view1, null, false);
  ShowCaseImageView image_showcase= view.findViewById(R.id.image_showcase);
  image_showcase.setmAnimationEnabled(false);
  image_showcase.setmCalculatorBeen(beanArrayList);
  image_showcase.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      showCaseView.dismiss();
    }
  });
  return view;
}

代码示例来源:origin: stackoverflow.com

button.getLocationOnScreen(location);

代码示例来源:origin: stackoverflow.com

overlayedButton.getLocationOnScreen(location);

代码示例来源:origin: r17171709/android_demo

public View b() {
    ArrayList<CalculatorBean> beanArrayList=new ArrayList<>();

    int[] location1=new int[2];
    btn1_showcase.getLocationOnScreen(location1);
    CalculatorBean bean1=new CalculatorBean();
    bean1.setmCircleCenterX(location1[0]+btn1_showcase.getMeasuredWidth()/2);
    bean1.setmCircleCenterY(location1[1]+btn1_showcase.getMeasuredHeight()/2);
    bean1.setmCircleRadius(20);
    bean1.setmFocusHeight(btn1_showcase.getMeasuredHeight());
    bean1.setmFocusWidth(btn1_showcase.getMeasuredWidth());
    bean1.setmFocusShape(FocusShape.ROUNDED_RECTANGLE);
    beanArrayList.add(bean1);

    View view= LayoutInflater.from(MainActivity.this).inflate(R.layout.view1, null, false);
    ShowCaseImageView image_showcase= view.findViewById(R.id.image_showcase);
    image_showcase.setmAnimationEnabled(false);
    image_showcase.setmCalculatorBeen(beanArrayList);
    image_showcase.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
        showCaseView.dismiss();
      }
    });

    return view;
  }
}

相关文章

Button类方法