android.widget.TextView#getGravity ( )源码实例Demo

下面列出了android.widget.TextView#getGravity ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: animation-samples   文件: TextResize.java
public TextResizeData(TextView textView) {
    this.paddingLeft = textView.getPaddingLeft();
    this.paddingTop = textView.getPaddingTop();
    this.paddingRight = textView.getPaddingRight();
    this.paddingBottom = textView.getPaddingBottom();
    this.width = textView.getWidth();
    this.height = textView.getHeight();
    this.gravity = textView.getGravity();
    this.textColor = textView.getCurrentTextColor();
}
 
源代码2 项目: atlas   文件: TextResize.java
public TextResizeData(TextView textView) {
    this.paddingLeft = textView.getPaddingLeft();
    this.paddingTop = textView.getPaddingTop();
    this.paddingRight = textView.getPaddingRight();
    this.paddingBottom = textView.getPaddingBottom();
    this.width = textView.getWidth();
    this.height = textView.getHeight();
    this.gravity = textView.getGravity();
    this.textColor = textView.getCurrentTextColor();
}
 
源代码3 项目: android-instant-apps   文件: TextResize.java
public TextResizeData(TextView textView) {
    this.paddingLeft = textView.getPaddingLeft();
    this.paddingTop = textView.getPaddingTop();
    this.paddingRight = textView.getPaddingRight();
    this.paddingBottom = textView.getPaddingBottom();
    this.width = textView.getWidth();
    this.height = textView.getHeight();
    this.gravity = textView.getGravity();
    this.textColor = textView.getCurrentTextColor();
}
 
源代码4 项目: android-login   文件: TextSizeTransition.java
public TextResizeData(TextView textView) {
  this.paddingLeft = textView.getPaddingLeft();
  this.paddingTop = textView.getPaddingTop();
  this.paddingRight = textView.getPaddingRight();
  this.paddingBottom = textView.getPaddingBottom();
  this.width = textView.getWidth();
  this.height = textView.getHeight();
  this.gravity = textView.getGravity();
  this.textColor = textView.getCurrentTextColor();
}
 
源代码5 项目: carouselview   文件: ConfigRowLayout.java
@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//		super.measure(widthMeasureSpec, heightMeasureSpec);

		final int childCount = getChildCount();

		if (childCount > 2) {
			throw new IllegalArgumentException("Number of childs cannot be larger than 2 for " + getClass().getSimpleName() + ".");
		}

		int topOffset = getPaddingTop();
		int leftOffset = getPaddingLeft();
		int rightOffset = getPaddingRight();
		int bottomOffset = getPaddingBottom();

		int contentWidth = getMeasuredWidth() - leftOffset - rightOffset;
		int contentHeight = getMeasuredHeight() - topOffset - bottomOffset;

		mMaxHeight = 0;
		for (int i = childCount - 1; i >= 0; --i) {
			View child = getChildAt(i);
//			Size childSize = measureChildSize(child, contentWidth, MeasureSpec.UNSPECIFIED);
//			mMaxHeight = Math.max(mMaxHeight, childSize.height);

			if (child.getVisibility() != View.GONE) {
				if (child.getClass().equals(TextView.class)) {
					mTextView = (TextView) child;
				} else {
					mContentView = child;
				}
			}
		}

		//==

		if (mContentView == null) {
			mContentView = mTextView;
			mTextView = null;
		}

		updatePendingText();

		if (mTextView != null) {
			if (mTextView.getGravity() != Gravity.RIGHT) {
				mTextView.setGravity(Gravity.RIGHT);
			}
			mTextViewSize = measureChildSize(mTextView, contentWidth, MeasureSpec.UNSPECIFIED);
			mMaxHeight = Math.max(mMaxHeight, mTextViewSize.height);
		}

		mContentViewAvailableWidth = contentWidth - (mTextViewSize != null ? mTextViewSize.width /*+ (int) Metrics.convertDpToPixel(8, getContext())*/ : 0);

		if (mContentView != null) {
			mContentViewSize = measureChildSize(mContentView, mContentViewAvailableWidth, MeasureSpec.UNSPECIFIED);
			mMaxHeight = Math.max(mMaxHeight, mContentViewSize.height);
		}

		setMeasuredDimension(widthMeasureSpec, MeasureSpec.makeMeasureSpec(mMaxHeight + topOffset + bottomOffset, MeasureSpec.EXACTLY));
	}
 
 方法所在类
 同类方法