You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.
java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams
at android.widget.FrameLayout.onMeasure(FrameLayout.java:195)
at android.support.v7.widget.CardView.onMeasure(CardView.java:211)
at android.view.View.measure(View.java:18788)
Here, the RelativeLayout.LayoutParams is typecasted to FrameLayout.LayoutParams which causes the exception. IIRC, the LayoutParams is choosen by Anko depending on the parent which should have been FrameLayout.LayoutParams for a CardView but is chosen as RelativeLayout.LayoutParams. For the time being, I've found a workaround which is given below.
Hi,
I have a DSL similar to the following:
But this throws the following exception:
Because of this line https://android.googlesource.com/platform/frameworks/support/+/master/v7/cardview/src/android/support/v7/widget/CardView.java#211 that calls
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
which in turn calls https://chromium.googlesource.com/android_tools/+/master/sdk/sources/android-23/android/widget/FrameLayout.java#195 orfinal LayoutParams lp = (LayoutParams) child.getLayoutParams();
Here, the
RelativeLayout.LayoutParams
is typecasted toFrameLayout.LayoutParams
which causes the exception. IIRC, theLayoutParams
is choosen by Anko depending on the parent which should have beenFrameLayout.LayoutParams
for a CardView but is chosen asRelativeLayout.LayoutParams
. For the time being, I've found a workaround which is given below.I'd like to know if this is a bug in Anko or if I'm doing something wrong. Please advice.
The text was updated successfully, but these errors were encountered: