当前位置: 首页>>代码示例>>Java>>正文


Java View.getLayoutDirection方法代码示例

本文整理汇总了Java中android.view.View.getLayoutDirection方法的典型用法代码示例。如果您正苦于以下问题:Java View.getLayoutDirection方法的具体用法?Java View.getLayoutDirection怎么用?Java View.getLayoutDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.getLayoutDirection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performResizeAction

import android.view.View; //导入方法依赖的package包/类
@Thunk private void performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
    CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
    CellLayout layout = (CellLayout) host.getParent().getParent();
    layout.markCellsAsUnoccupiedForView(host);

    if (action == R.string.action_increase_width) {
        if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
                && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY))
                || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
            lp.cellX --;
            info.cellX --;
        }
        lp.cellHSpan ++;
        info.spanX ++;
    } else if (action == R.string.action_decrease_width) {
        lp.cellHSpan --;
        info.spanX --;
    } else if (action == R.string.action_increase_height) {
        if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
            lp.cellY --;
            info.cellY --;
        }
        lp.cellVSpan ++;
        info.spanY ++;
    } else if (action == R.string.action_decrease_height) {
        lp.cellVSpan --;
        info.spanY --;
    }

    layout.markCellsAsOccupiedForView(host);
    Rect sizeRange = new Rect();
    AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange);
    ((LauncherAppWidgetHostView) host).updateAppWidgetSize(null,
            sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom);
    host.requestLayout();
    mLauncher.getModelWriter().updateItemInDatabase(info);
    announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY));
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:39,代码来源:LauncherAccessibilityDelegate.java

示例2: getLayoutDirection

import android.view.View; //导入方法依赖的package包/类
public static int getLayoutDirection(View v) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return v.getLayoutDirection();
    }

    return View.LAYOUT_DIRECTION_LTR;
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:8,代码来源:ViewHelper.java

示例3: convertGravity

import android.view.View; //导入方法依赖的package包/类
private static int convertGravity(View view, int gravity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        boolean isRtl = view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
        if (gravity == Gravity.START) {
            gravity = isRtl ? Gravity.RIGHT : Gravity.LEFT;
        } else if (gravity == Gravity.END) {
            gravity = isRtl ? Gravity.LEFT : Gravity.RIGHT;
        }
    }
    return gravity;
}
 
开发者ID:rumaan,项目名称:file.io-app,代码行数:12,代码来源:MaterialIn.java

示例4: getLayoutDirection

import android.view.View; //导入方法依赖的package包/类
@SuppressLint("NewApi")
static int getLayoutDirection(View v) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return v.getLayoutDirection();
    }

    return View.LAYOUT_DIRECTION_LTR;
}
 
开发者ID:Break369,项目名称:MyLife,代码行数:9,代码来源:ViewHelper.java

示例5: isLayoutRtl

import android.view.View; //导入方法依赖的package包/类
/**
 * Returns true if view's layout direction is right-to-left.
 *
 * @param view the View whose layout is being considered
 */
public static boolean isLayoutRtl(View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
    } else {
        // All layouts are LTR before JB MR1.
        return false;
    }
}
 
开发者ID:lizhangqu,项目名称:chromium-net-for-android,代码行数:14,代码来源:ApiCompatibilityUtils.java

示例6: getLayoutDirection

import android.view.View; //导入方法依赖的package包/类
public static int getLayoutDirection(View view) {
    return view.getLayoutDirection();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:ViewCompatJellybeanMr1.java

示例7: performResizeAction

import android.view.View; //导入方法依赖的package包/类
@Thunk void performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
    CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
    CellLayout layout = (CellLayout) host.getParent().getParent();
    layout.markCellsAsUnoccupiedForView(host);

    if (action == R.string.action_increase_width) {
        if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
                && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY))
                || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
            lp.cellX --;
            info.cellX --;
        }
        lp.cellHSpan ++;
        info.spanX ++;
    } else if (action == R.string.action_decrease_width) {
        lp.cellHSpan --;
        info.spanX --;
    } else if (action == R.string.action_increase_height) {
        if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
            lp.cellY --;
            info.cellY --;
        }
        lp.cellVSpan ++;
        info.spanY ++;
    } else if (action == R.string.action_decrease_height) {
        lp.cellVSpan --;
        info.spanY --;
    }

    layout.markCellsAsOccupiedForView(host);
    Rect sizeRange = new Rect();
    AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange);
    ((LauncherAppWidgetHostView) host).updateAppWidgetSize(null,
            sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom);
    host.requestLayout();
    LauncherModel.updateItemInDatabase(mLauncher, info);
    announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY));
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:39,代码来源:LauncherAccessibilityDelegate.java

示例8: createRelativeInsetDrawable

import android.view.View; //导入方法依赖的package包/类
/**
 * Creates an {@link android.graphics.drawable.InsetDrawable} according to the layout direction
 * of {@code view}.
 */
public static InsetDrawable createRelativeInsetDrawable(Drawable drawable,
        int insetStart, int insetTop, int insetEnd, int insetBottom, View view) {
    boolean isRtl = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
            && view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
    return createRelativeInsetDrawable(drawable, insetStart, insetTop, insetEnd, insetBottom,
            isRtl);
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:12,代码来源:DrawableLayoutDirectionHelper.java


注:本文中的android.view.View.getLayoutDirection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。