List of usage examples for android.view View LAYOUT_DIRECTION_RTL
int LAYOUT_DIRECTION_RTL
To view the source code for android.view View LAYOUT_DIRECTION_RTL.
Click Source Link
From source file:Main.java
/** * Determines whether the given view has RTL layout. *///w w w.j a va2 s. co m @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static boolean isLayoutRtl(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == view.getLayoutDirection(); } else { return false; } }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static void forceRTLIfSupported(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { activity.getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); }/*w ww .j a v a 2 s . com*/ }
From source file:Main.java
/** * 23 * Returns true if view's layout direction is right-to-left. * 24 */* w w w .j a v a 2 s .c om*/ * 25 * @param view the View whose layout is being considered * 26 */ @SuppressLint("NewApi") public static boolean isLayoutRtl(View view) { if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } else { // All layouts are LTR before JB MR1. return false; } }
From source file:Main.java
/** * Determines whether the given view has RTL layout. *//*from w w w.j av a2s. c o m*/ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static boolean isLayoutRtl(View view) { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && View.LAYOUT_DIRECTION_RTL == view.getLayoutDirection(); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static boolean isRtl(final Context context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { return false; } else {//from w w w. ja v a 2 s .co m return context.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } }
From source file:Main.java
/** * Returns true if view's layout direction is right-to-left. * * @param view the View whose layout is being considered */// ww w .j a va 2s .co m public static boolean isLayoutRtl(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } else { // All layouts are LTR before JB MR1. return false; } }
From source file:com.sonymobile.androidapp.gridcomputing.fragments.WizardMainFragment.java
/** * Verifies if current displayed language is Right-to-left. * * @return true if current displayed language is Right-to-left, false * otherwise.// w w w . j a va 2s .c om */ public static boolean isRtl() { return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; }
From source file:studioidan.com.parsetest.MainActivity.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void forceRTLIfSupported() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); }//from w w w . j ava 2s . c o m }
From source file:android.support.v17.leanback.widget.HorizontalHoverCardSwitcher.java
@Override protected void onViewSelected(View view) { int rightLimit = getParentViewGroup().getWidth() - getParentViewGroup().getPaddingRight(); int leftLimit = getParentViewGroup().getPaddingLeft(); // measure the hover card width; if it's too large, align hover card // end edge with row view's end edge, otherwise align start edges. view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams(); boolean isRtl = ViewCompat.getLayoutDirection(view) == View.LAYOUT_DIRECTION_RTL; if (!isRtl && mCardLeft + view.getMeasuredWidth() > rightLimit) { params.leftMargin = rightLimit - view.getMeasuredWidth(); } else if (isRtl && mCardLeft < leftLimit) { params.leftMargin = leftLimit;//from w w w. j a v a 2s. c om } else if (isRtl) { params.leftMargin = mCardRight - view.getMeasuredWidth(); } else { params.leftMargin = mCardLeft; } view.requestLayout(); }
From source file:com.android.settings.widget.RtlCompatibleViewPager.java
/** * Get a "RTL friendly" index. If the locale is LTR, the index is returned as is. * Otherwise it's transformed so view pager can render views using the new index for RTL. For * example, the second view will be rendered to the left of first view. * * @param index The logical index.//w w w .j av a 2s . c o m */ public int getRtlAwareIndex(int index) { // Using TextUtils rather than View.getLayoutDirection() because LayoutDirection is not // defined until onMeasure, and this is called before then. if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) { return getAdapter().getCount() - index - 1; } return index; }