本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
}