SwipeLayout - cannot resolve symbol 'drag_edge' inside attr.xml

144 Views Asked by At

I'm trying to understand what i missed. I have the implementation of SwipeLayout class with the next lines inside constructor:

public SwipeLayout(Context context, AttributeSet attrs, int defStyle) {
    ...
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeLayout);
    int dragEdgeChoices = a.getInt(R.styleable.SwipeLayout_drag_edge, DRAG_RIGHT);
    mEdgeSwipesOffset[DragEdge.Left.ordinal()] = a.getDimension(R.styleable.SwipeLayout_leftEdgeSwipeOffset, 0);
    mEdgeSwipesOffset[DragEdge.Right.ordinal()] = a.getDimension(R.styleable.SwipeLayout_rightEdgeSwipeOffset, 0);
    mEdgeSwipesOffset[DragEdge.Top.ordinal()] = a.getDimension(R.styleable.SwipeLayout_topEdgeSwipeOffset, 0);
    mEdgeSwipesOffset[DragEdge.Bottom.ordinal()] = a.getDimension(R.styleable.SwipeLayout_bottomEdgeSwipeOffset, 0);
    setClickToClose(a.getBoolean(R.styleable.SwipeLayout_clickToClose, mClickToClose));
    ...
}

and have an attr.xml file with styleable values:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SwipeLayout">
    <attr name="drag_edge">
        <flag name="left" value="1" />
        <flag name="right" value="2" />
        <flag name="top" value="4" />
        <flag name="bottom" value="8" />
    </attr>
    <attr name="leftEdgeSwipeOffset" format="dimension" />
    <attr name="rightEdgeSwipeOffset" format="dimension" />
    <attr name="topEdgeSwipeOffset" format="dimension" />
    <attr name="bottomEdgeSwipeOffset" format="dimension" />
    <attr name="show_mode" format="enum">
        <enum name="lay_down" value="0" />
        <enum name="pull_out" value="1" />
    </attr>
    <attr name="clickToClose" format="boolean" />
</declare-styleable>
</resources>

But it is an error inside xml that tells me that names like "drag_edge", "leftEdgeSwipeOffset", "rightEdgeSwipeOffset" and others are not found. Maybe I have missed some support or design libraries?

0

There are 0 best solutions below