It is wrong to use margin to achieve absolute positioning. This will not increase if you ever need fields.
Steal the code from Android, change it, and then use your "non-deprecated" absolute layout.
AbsoluteLayout is deprecated because they do not want to support it, and not because it does not work.
Screw this, their layouts do not do what we need, so what do they recommend? custom view.
So here (refactoring, without style support (puke)):
package com.example; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.RemoteViews.RemoteView; @RemoteView public class DCAbsoluteLayout extends ViewGroup { int mPaddingLeft, mPaddingRight, mPaddingTop, mPaddingBottom; public DCAbsoluteLayout(Context context) { super(context); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int count = getChildCount(); int maxHeight = 0; int maxWidth = 0;
In general, the Android user interface is a nightmare. Consider using web browsing for your entire project. As for working with the system, "everything is in order", but this interface is a train wreck.
HTML has always been an approach to styles and dynamic user interface content. Nothing beats it except the user interface (in terms of performance).
Hypersoft systems
source share