本文整理汇总了Java中android.content.res.Configuration.getLayoutDirection方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getLayoutDirection方法的具体用法?Java Configuration.getLayoutDirection怎么用?Java Configuration.getLayoutDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.res.Configuration
的用法示例。
在下文中一共展示了Configuration.getLayoutDirection方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRTL
import android.content.res.Configuration; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private boolean isRTL() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return false;
}
Configuration config = getResources().getConfiguration();
return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}
示例2: invertGravityIfNecessary
import android.content.res.Configuration; //导入方法依赖的package包/类
private void invertGravityIfNecessary() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return;
Configuration config = getResources().getConfiguration();
if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
switch (buttonGravity) {
case START:
buttonGravity = GravityEnum.END;
break;
case END:
buttonGravity = GravityEnum.START;
break;
}
}
}
示例3: isRTL
import android.content.res.Configuration; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static boolean isRTL(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Configuration config = context.getResources().getConfiguration();
return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
} else return false;
}
示例4: getLayoutDirection
import android.content.res.Configuration; //导入方法依赖的package包/类
/**
* @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;
}
}
示例5: getGravity
import android.content.res.Configuration; //导入方法依赖的package包/类
@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: shouldStartDragging
import android.content.res.Configuration; //导入方法依赖的package包/类
private boolean shouldStartDragging(int x, int draggerWidth) {
Configuration c = getResources().getConfiguration();
switch (c.getLayoutDirection()) {
case View.LAYOUT_DIRECTION_RTL:
return (x >= (getWidth() - draggerWidth));
default:
return (x <= draggerWidth);
}
}
示例7: isRTL
import android.content.res.Configuration; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private boolean isRTL() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
return false;
Configuration config = dialog.getBuilder().getContext().getResources().getConfiguration();
return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}
示例8: getLayoutDirection
import android.content.res.Configuration; //导入方法依赖的package包/类
@TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
public static int getLayoutDirection(Context context) {
Configuration configuration = context.getResources().getConfiguration();
return configuration.getLayoutDirection();
}
示例9: isRTL
import android.content.res.Configuration; //导入方法依赖的package包/类
public static boolean isRTL(Configuration config) {
return (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
}