public class XUILayoutHelper extends java.lang.Object implements IXUILayout
IXUILayout.HideRadiusSideHIDE_RADIUS_SIDE_BOTTOM, HIDE_RADIUS_SIDE_LEFT, HIDE_RADIUS_SIDE_NONE, HIDE_RADIUS_SIDE_RIGHT, HIDE_RADIUS_SIDE_TOP| Constructor and Description |
|---|
XUILayoutHelper(android.content.Context context,
android.util.AttributeSet attrs,
int defAttr,
android.view.View owner) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispatchRoundBorderDraw(android.graphics.Canvas canvas) |
void |
drawDividers(android.graphics.Canvas canvas,
int w,
int h) |
int |
getHideRadiusSide()
get the side that we have hidden the radius
|
int |
getMeasuredHeightSpec(int heightMeasureSpec) |
int |
getMeasuredWidthSpec(int widthMeasureSpec) |
int |
getRadius()
get the layout radius
|
float |
getShadowAlpha()
get the outline alpha we set
|
int |
getShadowColor() |
int |
getShadowElevation()
See
View.getElevation() |
int |
handleMiniHeight(int heightMeasureSpec,
int measuredHeight) |
int |
handleMiniWidth(int widthMeasureSpec,
int measuredWidth) |
boolean |
isRadiusWithSideHidden()
有radius, 但是有一边不显示radius。
|
void |
onlyShowBottomDivider(int bottomInsetLeft,
int bottomInsetRight,
int bottomDividerHeight,
int bottomDividerColor)
show bottom divider, and hide others
|
void |
onlyShowLeftDivider(int leftInsetTop,
int leftInsetBottom,
int leftDividerWidth,
int leftDividerColor)
show left divider, and hide others
|
void |
onlyShowRightDivider(int rightInsetTop,
int rightInsetBottom,
int rightDividerWidth,
int rightDividerColor)
show right divider, and hide others
|
void |
onlyShowTopDivider(int topInsetLeft,
int topInsetRight,
int topDividerHeight,
int topDividerColor)
show top divider, and hide others
|
void |
setBorderColor(int borderColor)
border color, if you don not set it, the layout will not draw the border
|
void |
setBorderWidth(int borderWidth)
border width, default is 1px, usually no need to set
|
void |
setBottomDividerAlpha(int dividerAlpha) |
boolean |
setHeightLimit(int heightLimit)
limit the height of a layout
|
void |
setHideRadiusSide(int hideRadiusSide)
in some case, we maybe hope the layout only have radius in one side.
|
void |
setLeftDividerAlpha(int dividerAlpha) |
void |
setOuterNormalColor(int color)
only available before android L
|
void |
setOutlineExcludePadding(boolean outlineExcludePadding)
determine if the outline contain the padding area, usually false
|
void |
setOutlineInset(int left,
int top,
int right,
int bottom)
inset the outline if needed
|
void |
setRadius(int radius)
set the layout radius
|
void |
setRadius(int radius,
int hideRadiusSide)
set the layout radius with one or none side been hidden
|
void |
setRadiusAndShadow(int radius,
int shadowElevation,
float shadowAlpha)
this method will determine the radius and shadow.
|
void |
setRadiusAndShadow(int radius,
int hideRadiusSide,
int shadowElevation,
float shadowAlpha)
this method will determine the radius and shadow with one or none side be hidden
|
void |
setRadiusAndShadow(int radius,
int hideRadiusSide,
int shadowElevation,
int shadowColor,
float shadowAlpha)
this method will determine the radius and shadow (support shadowColor if after android 9)with one or none side be hidden
|
void |
setRightDividerAlpha(int dividerAlpha) |
void |
setShadowAlpha(float shadowAlpha)
set the outline alpha, which will change the shadow
|
void |
setShadowColor(int shadowColor) |
void |
setShadowElevation(int elevation)
See
View.setElevation(float) |
void |
setShowBorderOnlyBeforeL(boolean showBorderOnlyBeforeL)
the shadow elevation only work after L, so we provide a downgrading compatible solutions for android 4.x
usually we use border, but the border may be redundant for android L+.
|
void |
setTopDividerAlpha(int dividerAlpha)
after config the border, sometimes we need change the alpha of divider with animation,
so we provide a method to individually change the alpha
|
void |
setUseThemeGeneralShadowElevation()
use the shadow elevation from the theme
|
boolean |
setWidthLimit(int widthLimit)
limit the width of a layout
|
void |
updateBottomDivider(int bottomInsetLeft,
int bottomInsetRight,
int bottomDividerHeight,
int bottomDividerColor)
config the bottom divider
|
void |
updateLeftDivider(int leftInsetTop,
int leftInsetBottom,
int leftDividerWidth,
int leftDividerColor)
config the left divider
|
void |
updateRightDivider(int rightInsetTop,
int rightInsetBottom,
int rightDividerWidth,
int rightDividerColor)
config the right divider
|
void |
updateTopDivider(int topInsetLeft,
int topInsetRight,
int topDividerHeight,
int topDividerColor)
config the top divider
|
static boolean |
useFeature() |
public XUILayoutHelper(android.content.Context context,
android.util.AttributeSet attrs,
int defAttr,
android.view.View owner)
public void setUseThemeGeneralShadowElevation()
IXUILayoutsetUseThemeGeneralShadowElevation in interface IXUILayoutpublic void setOutlineExcludePadding(boolean outlineExcludePadding)
IXUILayoutsetOutlineExcludePadding in interface IXUILayoutpublic boolean setWidthLimit(int widthLimit)
IXUILayoutsetWidthLimit in interface IXUILayoutpublic boolean setHeightLimit(int heightLimit)
IXUILayoutsetHeightLimit in interface IXUILayoutpublic int getShadowElevation()
IXUILayoutView.getElevation()getShadowElevation in interface IXUILayoutpublic float getShadowAlpha()
IXUILayoutgetShadowAlpha in interface IXUILayoutpublic int getShadowColor()
getShadowColor in interface IXUILayoutpublic void setOutlineInset(int left,
int top,
int right,
int bottom)
IXUILayoutsetOutlineInset in interface IXUILayoutpublic void setShowBorderOnlyBeforeL(boolean showBorderOnlyBeforeL)
IXUILayoutsetShowBorderOnlyBeforeL in interface IXUILayoutpublic void setShadowElevation(int elevation)
IXUILayoutView.setElevation(float)setShadowElevation in interface IXUILayoutpublic void setShadowAlpha(float shadowAlpha)
IXUILayoutsetShadowAlpha in interface IXUILayoutpublic void setShadowColor(int shadowColor)
setShadowColor in interface IXUILayoutshadowColor - opaque colorpublic void setHideRadiusSide(int hideRadiusSide)
IXUILayoutsetHideRadiusSide in interface IXUILayoutpublic int getHideRadiusSide()
IXUILayoutgetHideRadiusSide in interface IXUILayoutpublic void setRadius(int radius)
IXUILayoutsetRadius in interface IXUILayoutpublic void setRadius(int radius,
int hideRadiusSide)
IXUILayoutsetRadius in interface IXUILayoutpublic int getRadius()
IXUILayoutgetRadius in interface IXUILayoutpublic void setRadiusAndShadow(int radius,
int shadowElevation,
float shadowAlpha)
IXUILayoutsetRadiusAndShadow in interface IXUILayoutpublic void setRadiusAndShadow(int radius,
int hideRadiusSide,
int shadowElevation,
float shadowAlpha)
IXUILayoutsetRadiusAndShadow in interface IXUILayoutpublic void setRadiusAndShadow(int radius,
int hideRadiusSide,
int shadowElevation,
int shadowColor,
float shadowAlpha)
IXUILayoutsetRadiusAndShadow in interface IXUILayoutpublic boolean isRadiusWithSideHidden()
public void updateTopDivider(int topInsetLeft,
int topInsetRight,
int topDividerHeight,
int topDividerColor)
IXUILayoutupdateTopDivider in interface IXUILayoutpublic void updateBottomDivider(int bottomInsetLeft,
int bottomInsetRight,
int bottomDividerHeight,
int bottomDividerColor)
IXUILayoutupdateBottomDivider in interface IXUILayoutpublic void updateLeftDivider(int leftInsetTop,
int leftInsetBottom,
int leftDividerWidth,
int leftDividerColor)
IXUILayoutupdateLeftDivider in interface IXUILayoutpublic void updateRightDivider(int rightInsetTop,
int rightInsetBottom,
int rightDividerWidth,
int rightDividerColor)
IXUILayoutupdateRightDivider in interface IXUILayoutpublic void onlyShowTopDivider(int topInsetLeft,
int topInsetRight,
int topDividerHeight,
int topDividerColor)
IXUILayoutonlyShowTopDivider in interface IXUILayoutpublic void onlyShowBottomDivider(int bottomInsetLeft,
int bottomInsetRight,
int bottomDividerHeight,
int bottomDividerColor)
IXUILayoutonlyShowBottomDivider in interface IXUILayoutpublic void onlyShowLeftDivider(int leftInsetTop,
int leftInsetBottom,
int leftDividerWidth,
int leftDividerColor)
IXUILayoutonlyShowLeftDivider in interface IXUILayoutpublic void onlyShowRightDivider(int rightInsetTop,
int rightInsetBottom,
int rightDividerWidth,
int rightDividerColor)
IXUILayoutonlyShowRightDivider in interface IXUILayoutpublic void setTopDividerAlpha(int dividerAlpha)
IXUILayoutsetTopDividerAlpha in interface IXUILayoutdividerAlpha - [0, 255]public void setBottomDividerAlpha(int dividerAlpha)
setBottomDividerAlpha in interface IXUILayoutdividerAlpha - [0, 255]public void setLeftDividerAlpha(int dividerAlpha)
setLeftDividerAlpha in interface IXUILayoutdividerAlpha - [0, 255]public void setRightDividerAlpha(int dividerAlpha)
setRightDividerAlpha in interface IXUILayoutdividerAlpha - [0, 255]public int handleMiniWidth(int widthMeasureSpec,
int measuredWidth)
public int handleMiniHeight(int heightMeasureSpec,
int measuredHeight)
public int getMeasuredWidthSpec(int widthMeasureSpec)
public int getMeasuredHeightSpec(int heightMeasureSpec)
public void setBorderColor(int borderColor)
IXUILayoutsetBorderColor in interface IXUILayoutpublic void setBorderWidth(int borderWidth)
IXUILayoutsetBorderWidth in interface IXUILayoutpublic void setOuterNormalColor(int color)
IXUILayoutsetOuterNormalColor in interface IXUILayoutpublic void drawDividers(android.graphics.Canvas canvas,
int w,
int h)
public void dispatchRoundBorderDraw(android.graphics.Canvas canvas)
public static boolean useFeature()