本文整理匯總了Java中android.text.Layout.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java Layout.getHeight方法的具體用法?Java Layout.getHeight怎麽用?Java Layout.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.text.Layout
的用法示例。
在下文中一共展示了Layout.getHeight方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: flushView
import android.text.Layout; //導入方法依賴的package包/類
/**
* Flush view no matter what height and width the {@link WXDomObject} specifies.
* @param extra must be a {@link Layout} object, otherwise, nothing will happen.
*/
private void flushView(Object extra) {
if (extra instanceof Layout &&
getHostView() != null && !extra.equals(getHostView().getTextLayout())) {
final Layout layout = (Layout) extra;
/**The following if block change the height of the width of the textView.
* other part of the code is the same to updateExtra
*/
ViewGroup.LayoutParams layoutParams = getHostView().getLayoutParams();
if (layoutParams != null) {
layoutParams.height = layout.getHeight();
layoutParams.width = layout.getWidth();
getHostView().setLayoutParams(layoutParams);
}
getHostView().setTextLayout(layout);
getHostView().invalidate();
}
}
示例2: getTextLayoutHeight
import android.text.Layout; //導入方法依賴的package包/類
private int getTextLayoutHeight() {
Layout layout = mTextView.getLayout();
return layout == null ? -1 : layout.getHeight();
}
示例3: isOutOfBounds
import android.text.Layout; //導入方法依賴的package包/類
private boolean isOutOfBounds(Layout layout) {
return layout.getHeight() > getMeasuredHeight() - getPaddingBottom() - getPaddingTop();
}