Page 1201 - 3-3
P. 1201
ViewGroup.LayoutParams lp = pChild.getLayoutParams();
if(lp == null) {
lp = generateDefaultLayoutParams();
pChild.setLayoutParams(lp);
}
if(lp instanceof ScalableLayout.LayoutParams == false) {
throw new IllegalArgumentException("pChild has not ScalableLayout.LayoutParams
"+pChild.getLayoutParams());
}
return (ScalableLayout.LayoutParams) pChild.getLayoutParams();
}
/**
* sets TextSize of TextView and EdiText to scale automatically
* @param pTextView
* @param pScale_TextSize
*/
public void setScale_TextSize(TextView pTextView, float pScale_TextSize) {
getChildLayoutParams(pTextView).setScale_TextSize(pScale_TextSize);
}
/**
* @param pTextView target textview to wrap content
* @param pDirection
* @param pRescaleSurrounded
*/
public void setTextView_WrapContent(TextView pTextView, TextView_WrapContent_Direction
pDirection, boolean pRescaleSurrounded) {
setTextView_WrapContent(pTextView, pDirection, pRescaleSurrounded, true);
}
public void setTextView_WrapContent(TextView pTextView, TextView_WrapContent_Direction
pDirection, boolean pRescaleSurrounded, boolean pMoveSibligs) {
ge tChil dLay outP aram s(pT ext Vi ew).set Te xtV ie w_Wr apCon tent (pDir ectio n,
pRescaleSurrounded, pMoveSibligs);
refreshTextChangedListener(pTextView);
}
private TextWatcher mTextWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence pS, int pStart, int pBefore, int pCount) {
postDelayedRequestLayout();
}
@Override
public void beforeTextChanged(CharSequence pS, int pStart, int pCount, int pAfter) { }
@Override
public void afterTextChanged(Editable pS) {
- 1201 -