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 removed on future releases and my app stop working.
I’m copying from here: http://www.google.com/codesearch#cZwlSNS7aEw/frameworks/base/core/java/android/widget/AbsoluteLayout.java&exact_package=android&q=AbsoluteLayout&type=cs
But getting this code, first, I changed all the mPadding(Direction) to getPadding(Direction), but there’s still an error on the LayoutParams constructor:
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
TypedArray a = c.obtainStyledAttributes(attrs,
com.android.internal.R.styleable.AbsoluteLayout_Layout);
x = a.getDimensionPixelOffset(
com.android.internal.R.styleable.AbsoluteLayout_Layout_layout_x, 0);
y = a.getDimensionPixelOffset(
com.android.internal.R.styleable.AbsoluteLayout_Layout_layout_y, 0);
a.recycle();
}
com.android.internal.R cannot be resolved to a variable
How can I get these values? Or someone already has this class independently that don’t belong to google wishes to keep on the API?
You need to copy over
declare-styleableentry fromattrs.xml:Just add
res/values/attrs.xmlfile to your application and copy above lines there.When this is done, update your code to reference
Rfrom your package: