Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

_ScrollView does not implement MarginLayoutParams receiver #54

Closed
brennantaylor opened this issue May 31, 2015 · 1 comment
Closed

_ScrollView does not implement MarginLayoutParams receiver #54

brennantaylor opened this issue May 31, 2015 · 1 comment

Comments

@brennantaylor
Copy link

The example will repro the stacktrace at the bottom on Android 5.0.0

You may need a theme with the actionbar enabled. I am using android:Theme.Material.Light.DarkActionBar

class MainActivity() : Activity() {
    override fun onCreate(state: Bundle?) {
        super.onCreate(state)

        scrollView {
            verticalLayout {
                editText()
            }.layoutParams() {}
        }
    }
}
  java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.view.ViewGroup$MarginLayoutParams
      at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1252)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
      at android.widget.ScrollView.onMeasure(ScrollView.java:337)
      at android.view.View.measure(View.java:17430)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
@brennantaylor brennantaylor changed the title _ScrollView does not implement MarginLayoutParams _ScrollView does not implement MarginLayoutParams receiver May 31, 2015
EddieRingle added a commit to EddieRingle/anko that referenced this issue Jun 5, 2015
Previously the extractLayoutParams method was simply checking
the immediate ViewGroup for any inner class with "LayoutParams"
in its name. Now it traverses the ViewGroup's inheritance
tree, finds the nearest generateLayoutParams() method, and
uses its return type to determine the correct LayoutParams node.

Should fix Kotlin#54

Signed-off-by: Eddie Ringle <eddie@ringle.io>
@yanex
Copy link
Member

yanex commented Jun 10, 2015

Fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants