Skip to content

Just support static XML not suport dynamic addView #42

Description

@AlexMofer

Use ViewGroup's addView, will Crash on onLayout.
Use ViewGroup's addView(View, LayoutParams) with PhysicsFrameLayout.LayoutParams(context, null), will also Crash on onLayout.
Missing two override:

        @Override
        protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
            return p instanceof LayoutParams;
        }

        @Override
        protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
            return new LayoutParams(lp);// Add a constructor.
        }

       // Optional
       @Override
        protected FrameLayout.LayoutParams generateDefaultLayoutParams() {
            return new LayoutParams(getContext(), null);
        }

PhysicsFrameLayout.LayoutParams does not actually support null AttributeSet.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions