Java Code Examples for android.view.View#getMinimumWidth()

The following examples show how to use android.view.View#getMinimumWidth() . 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 File: ViewUtils.java    From AndroidScreenAdaptation with Apache License 2.0 5 votes vote down vote up
public static int getMinWidth(View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        return view.getMinimumWidth();
    } else {
        return getValue(view, METHOD_GET_MIN_WIDTH);
    }
}
 
Example 2
Source File: WidgetUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 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 3
Source File: ViewUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取 View 最小宽度
 * @param view View
 * @return View 最小宽度
 */
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN)
public static int getMinimumWidth(final View view) {
    if (view != null) {
        return view.getMinimumWidth();
    }
    return 0;
}
 
Example 4
Source File: MinWidthAttr.java    From AndroidAutoLayout with Apache License 2.0 5 votes vote down vote up
public static int getMinWidth(View view)
{
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        return view.getMinimumWidth();
    try
    {
        Field minWidth = view.getClass().getField("mMinWidth");
        minWidth.setAccessible(true);
        return (int) minWidth.get(view);
    } catch (Exception ignore)
    {
    }
    return 0;
}
 
Example 5
Source File: ViewCompatJB.java    From letv with Apache License 2.0 4 votes vote down vote up
public static int getMinimumWidth(View view) {
    return view.getMinimumWidth();
}
 
Example 6
Source File: ViewCompatJB.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static int getMinimumWidth(View view) {
    return view.getMinimumWidth();
}