本文整理匯總了Java中android.graphics.drawable.NinePatchDrawable.getIntrinsicWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java NinePatchDrawable.getIntrinsicWidth方法的具體用法?Java NinePatchDrawable.getIntrinsicWidth怎麽用?Java NinePatchDrawable.getIntrinsicWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.NinePatchDrawable
的用法示例。
在下文中一共展示了NinePatchDrawable.getIntrinsicWidth方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addDummyBoundaryPatch
import android.graphics.drawable.NinePatchDrawable; //導入方法依賴的package包/類
/**
* Add boundary patch for external Dummy input.
*
* @param xTo Horizontal coordinate to which the patch should extend. The starting coordinate
* is determined from this by subtracting patch width.
* @param inputView The {@link InputView} for the current input. This is used to determine patch
* height.
* @param inputLayoutOrigin The layout origin for the current input. This is used to determine
* the vertical position for the patch.
*/
private void addDummyBoundaryPatch(boolean isShadow, int xTo, InputView inputView,
ViewPoint inputLayoutOrigin) {
// For external dummy inputs, put a patch for the block boundary.
final NinePatchDrawable inputDrawable = getColoredPatchDrawable(
isShadow ? R.drawable.dummy_input_shadow : R.drawable.dummy_input);
final NinePatchDrawable inputBorderDrawable =
mPatchManager.getPatchDrawable(R.drawable.dummy_input_border);
int width = inputDrawable.getIntrinsicWidth();
if (mHasValueInput) {
// Stretch the patch horizontally if this block has at least one value
// input, so that the dummy input block boundary is as thick as the
// boundary with value input connector.
width += mPatchManager.mValueInputWidth;
}
boolean inTopRow = (inputLayoutOrigin.y == 0);
mHelper.setRtlAwareBounds(tempRect,
/* this width */ mBlockViewSize.x,
/* LTR start */ xTo - width,
/* top */ inputLayoutOrigin.y + (inTopRow ? mBlockTopPadding : 0),
/* LTR end */ xTo,
/* bottom */ inputLayoutOrigin.y + inputView.getRowHeight());
inputDrawable.setBounds(tempRect);
inputBorderDrawable.setBounds(tempRect);
mBlockPatches.add(inputDrawable);
mBlockBorderPatches.add(inputBorderDrawable);
}
示例2: addExternalValueInputPatch
import android.graphics.drawable.NinePatchDrawable; //導入方法依賴的package包/類
/**
* Add connector patch for external Value inputs.
*
* @param i The index of the current input. This is used to determine whether to position patch
* vertically below the field top boundary to account for the block's top boundary.
* @param xTo Horizontal coordinate to which the patch should extend. The starting coordinate
* is determined from this by subtracting patch width.
* @param inputView The {@link InputView} for the current input. This is used to determine patch
* height.
* @param inputLayoutOrigin The layout origin for the current input. This is used to determine
* the vertical position for the patch.
*/
private void addExternalValueInputPatch(boolean isShadow, int i, int xTo,
InputView inputView, ViewPoint inputLayoutOrigin) {
// Position patch and connector for external value input.
mHelper.setPointMaybeFlip(mInputConnectorOffsets.get(i), xTo, inputLayoutOrigin.y);
final NinePatchDrawable inputDrawable = getColoredPatchDrawable(isShadow
? R.drawable.value_input_external_shadow : R.drawable.value_input_external);
final NinePatchDrawable inputBorderDrawable =
mPatchManager.getPatchDrawable(R.drawable.value_input_external_border);
final NinePatchDrawable connectionHighlightDrawable =
mPatchManager.getPatchDrawable(R.drawable.value_input_external_connection);
int patchLeft = xTo - inputDrawable.getIntrinsicWidth();
int patchRight = xTo;
int connectorTop = inputLayoutOrigin.y + mBlockTopPadding;
int connectorBottom = inputLayoutOrigin.y + inputView.getMeasuredHeight();
mHelper.setRtlAwareBounds(tempRect,
/* this width */ mBlockViewSize.x,
/* LTR start */ patchLeft,
/* top */ connectorTop,
/* LTR end */ patchRight,
/* bottom */ connectorBottom);
inputDrawable.setBounds(tempRect);
inputBorderDrawable.setBounds(tempRect);
connectionHighlightDrawable.setBounds(tempRect);
mBlockPatches.add(inputDrawable);
mBlockBorderPatches.add(inputBorderDrawable);
mInputConnectionHighlightPatches.set(i, connectionHighlightDrawable);
if (i > 0) {
// If this is not the first input in the block, then a gap above the
// input connector patch must be closed by a non-input boundary patch.
// The gap is the result of the need to not draw over the top block
// boundary.
final NinePatchDrawable boundaryGapDrawable =
getColoredPatchDrawable(R.drawable.dummy_input);
final NinePatchDrawable boundaryGapBorderDrawable =
mPatchManager.getPatchDrawable(R.drawable.dummy_input_border);
mHelper.setRtlAwareBounds(tempRect,
/* this width */ mBlockViewSize.x,
/* LTR start */ patchLeft,
/* top */ inputLayoutOrigin.y,
/* LTR end */patchRight,
/* bottom */ connectorTop);
boundaryGapDrawable.setBounds(tempRect);
boundaryGapBorderDrawable.setBounds(tempRect);
mBlockPatches.add(boundaryGapDrawable);
mBlockBorderPatches.add(boundaryGapBorderDrawable);
}
}