Java Code Examples for androidx.core.view.GravityCompat#START

The following examples show how to use androidx.core.view.GravityCompat#START . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LockableDrawerLayout.java    From revolution-irc with GNU General Public License v3.0 5 votes vote down vote up
private int getDrawerWidth() {
    for (int i = getChildCount() - 1; i >= 0; --i) {
        View child = getChildAt(i);
        LayoutParams p = (LayoutParams) child.getLayoutParams();
        int hg = p.gravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK;
        if (hg == GravityCompat.START)
            return child.getMeasuredWidth();
    }
    return 0;
}
 
Example 2
Source File: FrameLayout.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public LayoutParams(Context c, AttributeSet attrs) {
    super(c, attrs);
    if (gravity <= 0)
        gravity = GravityCompat.START | Gravity.TOP;

    TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.FrameLayout_Layout);
    anchorView = a.getResourceId(R.styleable.FrameLayout_Layout_carbon_layout_anchor, -1);
    anchorGravity = a.getInt(R.styleable.FrameLayout_Layout_carbon_layout_anchorGravity, -1);
    if (a.hasValue(R.styleable.FrameLayout_Layout_carbon_layout_marginHorizontal))
        leftMargin = rightMargin = a.getDimensionPixelSize(R.styleable.FrameLayout_Layout_carbon_layout_marginHorizontal, 0);
    if (a.hasValue(R.styleable.FrameLayout_Layout_carbon_layout_marginVertical))
        topMargin = bottomMargin = a.getDimensionPixelSize(R.styleable.FrameLayout_Layout_carbon_layout_marginVertical, 0);
    a.recycle();
}
 
Example 3
Source File: HeaderScrollingViewBehavior.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
private static int resolveGravity(int gravity) {
  return gravity == Gravity.NO_GRAVITY ? GravityCompat.START | Gravity.TOP : gravity;
}
 
Example 4
Source File: FrameLayout.java    From Carbon with Apache License 2.0 4 votes vote down vote up
public LayoutParams(int w, int h) {
    super(w, h);
    if (gravity <= 0)
        gravity = GravityCompat.START | Gravity.TOP;
}
 
Example 5
Source File: FrameLayout.java    From Carbon with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public LayoutParams(ViewGroup.LayoutParams source) {
    super(source);
    if (gravity == 0)
        gravity = GravityCompat.START | Gravity.TOP;
}
 
Example 6
Source File: FrameLayout.java    From Carbon with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public LayoutParams(ViewGroup.MarginLayoutParams source) {
    super(source);
    if (gravity == 0)
        gravity = GravityCompat.START | Gravity.TOP;
}
 
Example 7
Source File: FrameLayout.java    From Carbon with Apache License 2.0 4 votes vote down vote up
public LayoutParams(android.widget.FrameLayout.LayoutParams source) {
    super((MarginLayoutParams) source);
    if (gravity == 0)
        gravity = GravityCompat.START | Gravity.TOP;
}