當前位置: 首頁>>代碼示例>>Java>>正文


Java View.LAYOUT_DIRECTION_LTR屬性代碼示例

本文整理匯總了Java中android.view.View.LAYOUT_DIRECTION_LTR屬性的典型用法代碼示例。如果您正苦於以下問題:Java View.LAYOUT_DIRECTION_LTR屬性的具體用法?Java View.LAYOUT_DIRECTION_LTR怎麽用?Java View.LAYOUT_DIRECTION_LTR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.view.View的用法示例。


在下文中一共展示了View.LAYOUT_DIRECTION_LTR屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: putLayoutDirectionIntoMap

private static void putLayoutDirectionIntoMap(AmazonWebView webView, Map<String, String> substitutionMap) {
    ViewCompat.setLayoutDirection(webView, View.LAYOUT_DIRECTION_LOCALE);
    final int layoutDirection = ViewCompat.getLayoutDirection(webView);

    final String direction;

    if (layoutDirection == View.LAYOUT_DIRECTION_LTR) {
        direction = "ltr";
    } else if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
        direction = "rtl";
    } else {
        direction = "auto";
    }

    substitutionMap.put("%dir%", direction);
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:16,代碼來源:LocalizedContent.java

示例2: onLayoutDirectionChanged

/**
 */
@Override
public boolean onLayoutDirectionChanged(int layoutDirection) {
	if (mProgressState.direction != layoutDirection) {
		switch (layoutDirection) {
			case View.LAYOUT_DIRECTION_LTR:
			case View.LAYOUT_DIRECTION_RTL:
				mProgressState.direction = layoutDirection;
				invalidateSelf();
				return true;
		}
	}
	return super.onLayoutDirectionChanged(layoutDirection);
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:15,代碼來源:ProgressDrawable.java

示例3: getLayoutDirection

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,代碼行數:7,代碼來源:ViewHelper.java

示例4: getLayoutDirection

@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,代碼行數:8,代碼來源:ViewHelper.java

示例5: getGravity

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public int getGravity() {
    if(Utils.hasJellyBeanMR1()){
        Configuration config = getResources().getConfiguration();
        if(config.getLayoutDirection() != View.LAYOUT_DIRECTION_LTR){
            return Gravity.LEFT;
        }
    }
    return Gravity.RIGHT;
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:10,代碼來源:DocumentsActivity.java

示例6: getLayoutDirection

/**
 * @see Configuration#getLayoutDirection()
 */
public static int getLayoutDirection(Configuration configuration) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return configuration.getLayoutDirection();
    } else {
        // All layouts are LTR before JB MR1.
        return View.LAYOUT_DIRECTION_LTR;
    }
}
 
開發者ID:lizhangqu,項目名稱:chromium-net-for-android,代碼行數:11,代碼來源:ApiCompatibilityUtils.java

示例7: getPreviewCenterX

float getPreviewCenterX(int width) {
    float ltr = (((View) previewLayout).getWidth() - previewChildView.getWidth())
            * getWidthOffset(previewView.getProgress()) + previewChildView.getWidth() / 2f
            - width / 2f;
    float rtl = (((View) previewLayout).getWidth() - previewChildView.getWidth())
            * (1 - getWidthOffset(previewView.getProgress())) + previewChildView.getWidth() / 2f
            - width / 2f;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return ((View) previewView).getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ?
                ltr : rtl;
    } else {
        return ltr;
    }
}
 
開發者ID:rubensousa,項目名稱:PreviewSeekBar,代碼行數:14,代碼來源:PreviewAnimator.java

示例8: getPreviewX

float getPreviewX() {
    float ltr = ((float) (((View) previewLayout).getWidth() - previewChildView.getWidth()))
            * getWidthOffset(previewView.getProgress());
    float rtl = ((float) (((View) previewLayout).getWidth() - previewChildView.getWidth()))
            * (1 - getWidthOffset(previewView.getProgress()));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return ((View) previewView).getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ?
                ltr : rtl;
    } else {
        return ltr;
    }
}
 
開發者ID:rubensousa,項目名稱:PreviewSeekBar,代碼行數:12,代碼來源:PreviewAnimator.java

示例9: setWindowLayoutRtl

/**
 * Sets window layout rtl.
 */
public static void setWindowLayoutRtl(Activity activity) {
    if (activity.getWindow()
            .getDecorView()
            .getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
        activity.getWindow()
                .getDecorView()
                .setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
    }
}
 
開發者ID:davideas,項目名稱:AndroidBlueprints,代碼行數:12,代碼來源:DisplayHelper.java

示例10: resolveLayoutDirection

static LayoutDirection resolveLayoutDirection(HoldingButtonLayout view) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return LayoutDirection.LTR;
    }

    int rawDirection = view.getResources().getConfiguration().getLayoutDirection();
    if (rawDirection == View.LAYOUT_DIRECTION_LTR) {
        return LayoutDirection.LTR;
    } else {
        return LayoutDirection.RTL;
    }
}
 
開發者ID:dewarder,項目名稱:HoldingButton,代碼行數:12,代碼來源:DirectionHelper.java


注:本文中的android.view.View.LAYOUT_DIRECTION_LTR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。