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