Java Code Examples for android.view.View#getMinimumHeight()
The following examples show how to use
android.view.View#getMinimumHeight() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: AndroidAutoLayout File: MinHeightAttr.java License: Apache License 2.0 | 6 votes |
public static int getMinHeight(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { return view.getMinimumHeight(); } else { try { Field minHeight = view.getClass().getField("mMinHeight"); minHeight.setAccessible(true); return (int) minHeight.get(view); } catch (Exception e) { } } return 0; }
Example 2
Source Project: CommonUtils File: CommonUtils.java License: Apache License 2.0 | 5 votes |
public static void expand(final View v, @Nullable Animation.AnimationListener listener) { final int targetHeight; if (v.getMinimumHeight() != 0) { targetHeight = v.getMinimumHeight(); } else { v.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); targetHeight = v.getMeasuredHeight(); } v.getLayoutParams().height = 0; v.setVisibility(View.VISIBLE); Animation a = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = interpolatedTime == 1 ? ViewGroup.LayoutParams.WRAP_CONTENT : (int) (targetHeight * interpolatedTime); v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; if (listener != null) a.setAnimationListener(listener); a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
Example 3
Source Project: AndroidScreenAdaptation File: ViewUtils.java License: Apache License 2.0 | 5 votes |
public static int getMinHeight(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { return view.getMinimumHeight(); } else { return getValue(view, METHOD_GET_MIN_HEIGHT); } }
Example 4
Source Project: DevUtils File: WidgetUtils.java License: Apache License 2.0 | 5 votes |
/** * View Measure * @param view 待计算 View * @param widthMeasureSpec horizontal space requirements as imposed by the parent * @param heightMeasureSpec vertical space requirements as imposed by the parent * @param maximumWidth maximum Width * @param maximumHeight maximum Height * @param defaultValue 默认值 * @return measure space Array */ public static int[] viewMeasure(final View view, final int widthMeasureSpec, final int heightMeasureSpec, final int maximumWidth, final int maximumHeight, final int defaultValue) { int minimumWidth = 0, minimumHeight = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { minimumWidth = view.getMinimumWidth(); minimumHeight = view.getMinimumHeight(); } return viewMeasure(widthMeasureSpec, heightMeasureSpec, minimumWidth, maximumWidth, minimumHeight, maximumHeight, defaultValue); }
Example 5
Source Project: DevUtils File: ViewUtils.java License: Apache License 2.0 | 5 votes |
/** * 获取 View 最小高度 * @param view View * @return View 最小高度 */ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN) public static int getMinimumHeight(final View view) { if (view != null) { return view.getMinimumHeight(); } return 0; }
Example 6
Source Project: letv File: ViewCompatJB.java License: Apache License 2.0 | 4 votes |
public static int getMinimumHeight(View view) { return view.getMinimumHeight(); }
Example 7
Source Project: adt-leanback-support File: ViewCompatJB.java License: Apache License 2.0 | 4 votes |
public static int getMinimumHeight(View view) { return view.getMinimumHeight(); }