静态 Public 成员函数 | |
| static void | setAbsListViewHeight (AbsListView absListView, int lineNumber, int verticalSpace) |
| static int | getAbsListViewHeight (AbsListView absListView, int lineNumber, int verticalSpace) |
| static void | measureView (View view) |
| static int | getViewWidth (View view) |
| static int | getViewHeight (View view) |
| static void | removeSelfFromParent (View v) |
| static float | dip2px (Context context, float dipValue) |
| static float | px2dip (Context context, float pxValue) |
| static float | sp2px (Context context, float spValue) |
| static float | px2sp (Context context, float pxValue) |
| static int | scale (Context context, float value) |
| static int | scale (int displayWidth, int displayHeight, float pxValue) |
| static float | applyDimension (int unit, float value, DisplayMetrics metrics) |
| static void | scaleContentView (ViewGroup contentView) |
| static void | scaleView (View view) |
| static void | setSPTextSize (TextView textView, float size) |
| static void | setTextSize (TextView textView, float sizePixels) |
| static void | setTextSize (Context context, TextPaint textPaint, float sizePixels) |
| static void | setTextSize (Context context, Paint paint, float sizePixels) |
| static void | setViewSize (View view, int widthPixels, int heightPixels) |
| static void | setPadding (View view, int left, int top, int right, int bottom) |
| static void | setMargin (View view, int left, int top, int right, int bottom) |
静态 Public 属性 | |
| static final int | INVALID = Integer.MIN_VALUE |
© 2012 amsoft.cn 名称:AbViewUtil.java 描述:View工具类.
|
inlinestatic |
TypedValue官方源码中的算法,任意单位转换为PX单位
| unit | TypedValue.COMPLEX_UNIT_DIP |
| value | 对应单位的值 |
| metrics | 密度 |
|
inlinestatic |
描述:dip转换为px.
| context | the context |
| dipValue | the dip value |
|
inlinestatic |
描述:获取AbsListView的高度.
| absListView | the abs list view |
| lineNumber | 每行几个 ListView一行一个item |
| verticalSpace | the vertical space |
|
inlinestatic |
获得这个View的高度 测量这个view,最后通过getMeasuredHeight()获取高度.
| view | 要测量的view |
|
inlinestatic |
获得这个View的宽度 测量这个view,最后通过getMeasuredWidth()获取宽度.
| view | 要测量的view |
|
inlinestatic |
测量这个view 最后通过getMeasuredWidth()获取宽度和高度.
| view | 要测量的view |
|
inlinestatic |
描述:px转换为dip.
| context | the context |
| pxValue | the px value |
|
inlinestatic |
描述:px转换为sp.
| context | the context |
| spValue | the sp value |
|
inlinestatic |
从父亲布局中移除自己
| v |
|
inlinestatic |
描述:根据屏幕大小缩放.
| context | the context |
| pxValue | the px value |
|
inlinestatic |
描述:根据屏幕大小缩放.
| displayWidth | the display width |
| displayHeight | the display height |
| pxValue | the px value |
|
inlinestatic |
描述:View树递归调用做适配. AbAppConfig.uiWidth = 1080; AbAppConfig.uiHeight = 700; scaleContentView((RelativeLayout)findViewById(R.id.rootLayout)); 要求布局中的单位都用px并且和美工的设计图尺寸一致,包括所有宽高,Padding,Margin,文字大小
| contentView |
|
inlinestatic |
按比例缩放View,以布局中的尺寸为基准
| view |
|
inlinestatic |
描述:重置AbsListView的高度. item 的最外层布局要用 RelativeLayout,如果计算的不准,就为RelativeLayout指定一个高度
| absListView | the abs list view |
| lineNumber | 每行几个 ListView一行一个item |
| verticalSpace | the vertical space |
|
inlinestatic |
设置 PX margin.
| view | the view |
| left | the left margin in pixels |
| top | the top margin in pixels |
| right | the right margin in pixels |
| bottom | the bottom margin in pixels |
|
inlinestatic |
设置PX padding.
| view | the view |
| left | the left padding in pixels |
| top | the top padding in pixels |
| right | the right padding in pixels |
| bottom | the bottom padding in pixels |
|
inlinestatic |
缩放文字大小
| textView | button |
| size | sp值 |
|
inlinestatic |
缩放文字大小,这样设置的好处是文字的大小不和密度有关, 能够使文字大小在不同的屏幕上显示比例正确
| textView | button |
| sizePixels | px值 |
|
inlinestatic |
缩放文字大小
| context | |
| textPaint | |
| sizePixels | px值 |
|
inlinestatic |
缩放文字大小
| context | |
| paint | |
| sizePixels | px值 |
|
inlinestatic |
设置View的PX尺寸
| view | 如果是代码new出来的View,需要设置一个适合的LayoutParams |
| widthPixels | |
| heightPixels |
|
inlinestatic |
描述:sp转换为px.
| context | the context |
| spValue | the sp value |
|
static |
无效值
1.8.8