當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。