Skip to content Skip to sidebar Skip to footer

Problem Copying Absolutelayout - Com.android.internal.r Cannot Be Resolved

I came to a problem that the only solutions is using a AbsoluteLayout (Just to show something at specific positions). I'm trying to copy the AbsoluteLayout class to avoid it being

Solution 1:

You need to copy over declare-styleable entry from attrs.xml:

<declare-styleablename="AbsoluteLayout_Layout"><attrname="layout_x"format="dimension" /><attrname="layout_y"format="dimension" /></declare-styleable>

Just add res/values/attrs.xml file to your application and copy above lines there.


When this is done, update your code to reference R from your package:

import com.your.package.R;
...
publicLayoutParams(Context c, AttributeSet attrs) {
    super(c, attrs);
    TypedArraya= c.obtainStyledAttributes(attrs,
            R.styleable.AbsoluteLayout_Layout);
    x = a.getDimensionPixelOffset(
            R.styleable.AbsoluteLayout_Layout_layout_x, 0);
    y = a.getDimensionPixelOffset(
            R.styleable.AbsoluteLayout_Layout_layout_y, 0);
    a.recycle();
}

Post a Comment for "Problem Copying Absolutelayout - Com.android.internal.r Cannot Be Resolved"