am 78528b22: Fixed a RTL layouting bug with LinearLayout
* commit '78528b22c29f570469fe3c75328042f83a5a24c3': Fixed a RTL layouting bug with LinearLayout
This commit is contained in:
@@ -26,6 +26,12 @@ public final class LayoutDirection {
|
||||
// No instantiation
|
||||
private LayoutDirection() {}
|
||||
|
||||
/**
|
||||
* An undefined layout direction.
|
||||
* @hide
|
||||
*/
|
||||
public static final int UNDEFINED = -1;
|
||||
|
||||
/**
|
||||
* Horizontal layout direction is from Left to Right.
|
||||
*/
|
||||
|
||||
@@ -1871,6 +1871,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ResolvedLayoutDir {}
|
||||
|
||||
/**
|
||||
* A flag to indicate that the layout direction of this view has not been defined yet.
|
||||
* @hide
|
||||
*/
|
||||
public static final int LAYOUT_DIRECTION_UNDEFINED = LayoutDirection.UNDEFINED;
|
||||
|
||||
/**
|
||||
* Horizontal layout direction of this view is from Left to Right.
|
||||
* Use with {@link #setLayoutDirection}.
|
||||
|
||||
@@ -185,6 +185,8 @@ public class LinearLayout extends ViewGroup {
|
||||
private int mShowDividers;
|
||||
private int mDividerPadding;
|
||||
|
||||
private int mLayoutDirection = View.LAYOUT_DIRECTION_UNDEFINED;
|
||||
|
||||
public LinearLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -1567,6 +1569,17 @@ public class LinearLayout extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRtlPropertiesChanged(@ResolvedLayoutDir int layoutDirection) {
|
||||
super.onRtlPropertiesChanged(layoutDirection);
|
||||
if (layoutDirection != mLayoutDirection) {
|
||||
mLayoutDirection = layoutDirection;
|
||||
if (mOrientation == HORIZONTAL) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Position the children during a layout pass if the orientation of this
|
||||
* LinearLayout is set to {@link #HORIZONTAL}.
|
||||
|
||||
Reference in New Issue
Block a user