当前位置: 首页>>代码示例>>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;未经允许,请勿转载。