Skip to content

ViewPager & RelativeLayout issues (Android) #606

@NickIliev

Description

@NickIliev

From @manijak on October 31, 2016 18:36

Did you verify this is a real problem by searching [Stack Overflow]

Yes.
Tried at first on the "next" versions of core-modules. But managed to get the same result on 2.3.0.

Tell us about the problem

I'm trying to add the android version to my Carousel plugin. Playing with the ViewPager and Layouts. If I return the ViewPager as _nativeView it works fine, but if I return the RelativeLayout as the _nativeView it fails.

java.lang.ClassCastException: android.support.v4.view.ViewPager$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams
	at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:476)
	at android.view.View.measure(View.java:18788)
	at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:229)
	at org.nativescript.widgets.StackLayout.onMeasure(StackLayout.java:83)
	at android.view.View.measure(View.java:18788)
	at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:229)
	at org.nativescript.widgets.MeasureHelper.measureChildFixedColumnsAndRows(GridLayout.java:1059)
	at org.nativescript.widgets.MeasureHelper.measure(GridLayout.java:869)
	at org.nativescript.widgets.GridLayout.onMeasure(GridLayout.java:279)
	at android.view.View.measure(View.java:18788)
	at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:229)
	at org.nativescript.widgets.ContentLayout.onMeasure(ContentLayout.java:32)
...

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.3.0
  • Cross-platform modules: 2.3.0
  • Runtime(s): 2.3.0

Please tell us how to recreate the issue in as much detail as possible.

Here is a sample app that will reproduce the issue (android only)
https://dl.dropboxusercontent.com/u/33168380/pager-test.zip

Copied from original issue: NativeScript/NativeScript#3001

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions