android.widget.TextView.getLocationInWindow()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(116)

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

TextView.getLocationInWindow介绍

暂无

代码示例

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

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

代码示例来源:origin: easefun/polyv-android-sdk-2.0-demo

private void setLineLocation(int position) {
  ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v_tabline.getLayoutParams();
  lp.width = tv_downloaded.getWidth();
  int[] wh = new int[2];
  if (position == 0) {
    tv_downloaded.getLocationInWindow(wh);
  } else if (position == 1) {
    tv_downloading.getLocationInWindow(wh);
  }
  lp.leftMargin = wh[0];
  v_tabline.setLayoutParams(lp);
}

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

ScrollView s = (ScrollView) findViewById(R.id.s);
TextView a = (TextView) findViewById(R.id.a);
s.post(new Runnable() {
  public void run() {
    int[] location = new int[2];
    a.getLocationInWindow(location);
    int y = location[1];
    s.getLocationInWindow(location);
    s.scrollTo(0, y-location[1]); // or some other calculation
  }
});

代码示例来源:origin: lltvcn/FreeText

@Override
      public void onShade(TextView textView) {
        //渐变
        int location[] = new int[2];
        textView.getLocationInWindow(location);
        textView.setText("国\n国");
        textView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));

        //需要一个矩形区域,并且从canvas左上角开始计算
        LinearGradient gradient = new LinearGradient(0,textView.getMeasuredHeight(),textView.getMeasuredWidth(),0,new int[]{Color.BLACK,Color.WHITE,Color.YELLOW},new float[]{0.1f,0.8f,0.1f}, Shader.TileMode.MIRROR);
//              LinearGradient gradient = new LinearGradient(0,textView.getTextSize(),textView.getTextSize(),0,Color.BLACK,Color.YELLOW, Shader.TileMode.REPEAT);
        textView.getPaint().setShader(gradient);
      }
    });

代码示例来源:origin: WeAreFairphone/FP2-Launcher

mEditButton.getLocationInWindow(coord);
switch (mSide)

代码示例来源:origin: whatshappen/TopGrid

@Override
  public void onDelete(final int position, View v, ViewGroup parent) {
    if (position != 0) {
      View view = userGridView.getChildAt(position);
      final ImageView moveImageView = getView(view);
      if (moveImageView != null) {
        TextView newTextView = (TextView) view.findViewById(R.id.text_item);
        final int[] startLocation = new int[2];
        newTextView.getLocationInWindow(startLocation);
        final ChannelItem channel = userAdapter.getItem(position);//获取点击的频道内容
        otherAdapter.setVisible(false);
        userAdapter.setIsDeleteing(true);
        //添加到最后一个
        otherAdapter.addItem(channel);
        new Handler().postDelayed(new Runnable() {
          public void run() {
            try {
              int[] endLocation = new int[2];
              //获取终点的坐标
              otherGridView.getChildAt(otherGridView.getLastVisiblePosition()).getLocationInWindow(endLocation);
              MoveAnim(moveImageView, startLocation , endLocation, channel,userGridView);
              userAdapter.setRemove(position);
            } catch (Exception localException) {
            }
          }
        }, 50L);
      }
    }
  }
});

代码示例来源:origin: derry/delion

mUrlBar.getLocationInWindow(oldLoc);

代码示例来源:origin: 6ag/BaoKanAndroid

TextView newTextView = (TextView) view.findViewById(R.id.text_item);
  final int[] startLocation = new int[2];
  newTextView.getLocationInWindow(startLocation);
  final ColumnBean columnBean = ((DragGridViewAdapter) parent.getAdapter()).getItem(position);//获取点击的频道内容
  mOptionalGridViewAdapter.setVisible(false);
TextView newTextView = (TextView) view.findViewById(R.id.text_item);
final int[] startLocation = new int[2];
newTextView.getLocationInWindow(startLocation);
final ColumnBean columnBean = ((OptionalGridViewAdapter) parent.getAdapter()).getItem(position);
mDragGridViewAdapter.setVisible(false);

代码示例来源:origin: derry/delion

@Override
  public void onLayoutChange(View v, int left, int top, int right, int bottom,
      int oldLeft, int oldTop, int oldRight, int oldBottom) {
    mUrlBar.removeOnLayoutChangeListener(this);
    int[] newLoc = new int[2];
    mUrlBar.getLocationInWindow(newLoc);
    mUrlBar.setScaleX(scale);
    mUrlBar.setScaleY(scale);
    mUrlBar.setTranslationX(oldLoc[0] - newLoc[0]);
    mUrlBar.setTranslationY(oldLoc[1] - newLoc[1]);
    mUrlBar.animate().scaleX(1f).scaleY(1f).translationX(0).translationY(0)
        .setDuration(CUSTOM_TAB_TOOLBAR_SLIDE_DURATION_MS)
        .setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE)
        .setListener(new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            mTitleBar.animate().alpha(1f)
              .setInterpolator(BakedBezierInterpolator.FADE_IN_CURVE)
              .setDuration(CUSTOM_TAB_TOOLBAR_FADE_DURATION_MS).start();
          }
        }).start();
  }
});

代码示例来源:origin: whatshappen/TopGrid

TextView newTextView = (TextView) view.findViewById(R.id.text_item);
final int[] startLocation = new int[2];
newTextView.getLocationInWindow(startLocation);
final ChannelItem channel = ((OtherAdapter) parent.getAdapter()).getItem(position);
userAdapter.setVisible(false);

代码示例来源:origin: fengyongge/shopcar

tv_car.getLocationInWindow(endLocation);

相关文章

微信公众号

最新文章

更多

TextView类方法