本文整理匯總了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;
}
}