CarouselViewは、サイズを指定しない限り、レイアウト内のすべての垂直方向のスペースを消費しています。 しかし、コンテンツに合わせてサイズを調整したいb / cを与えるための高さがわかりません。 高さか幅か、コンテンツのサイズを教えてください。
<StackLayout Margin="15">
<Frame BackgroundColor="White"
Padding="10"
BorderColor="Black"
CornerRadius="0">
<CarouselView>
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>rei_01.jpg</x:String>
<x:String>rei_02.jpg</x:String>
<x:String>rei_03.jpg</x:String>
<x:String>rei_04.jpg</x:String>
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding .}"/>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
</Frame>
</StackLayout>
CarouselViewは私のコンテンツに合わせてサイズを調整し、さまざまな画面サイズにわたって一貫したレイアウトを提供します。
CarouselViewはレイアウト内のすべてのスペースを消費し、他のレイアウトをビューから押し出します。 この画面で希望する結果を得るには高さを設定する必要がありますが、他のサイズの画面では見栄えが悪くなります。
すべての消費高さ:
固定高さ(推測):
これが起こっていることを確認しました。 コンテンツのサイズにするためにいくつかの異なることを試みましたが、常に利用可能な高さ全体を占めるようです。 Androidで発生します。
iOSでは完全にNREであり、スタックトレースは以下のとおりです。 しかし、それがこれに関連しているのかどうかはわかりません。 iOSエラーはシェルの問題のようです
System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Object obj、System.Object []パラメータ、System.Boolean wrapExceptions)[0x00018] in / Users / builder / jenkins / workspace / xamarin-macios / xamarin-macios / external / mono /mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:944
System.RuntimeType.CreateInstanceMono(System.Boolean nonPublic、System.Boolean wrapExceptions)[0x00095] in / Users / builder / jenkins / workspace / xamarin-macios / xamarin-macios / external / mono / mcs / class / corlib / ReferenceSources / RuntimeType.cs:185
System.RuntimeType.CreateInstanceSlow(System.Boolean publicOnly、System.Boolean wrapExceptions、System.Boolean skipCheckThis、System.Boolean fillCache)[0x00009] in / Users / builder / jenkins / workspace / xamarin-macios / xamarin-macios / external / mono / mcs / class / corlib / ReferenceSources / RuntimeType.cs:155
System.RuntimeType.CreateInstanceDefaultCtor(System.Boolean publicOnly、System.Boolean skipCheckThis、System.Boolean fillCache、System.Boolean wrapExceptions、System.Threading.StackCrawlMark&stackMark)[0x00027] in / Users / builder / jenkins / workspace / xamarin-macios /xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/rttype.cs:5770
System.Activator.CreateInstance(System.Type type、System.Boolean nonPublic、System.Boolean wrapExceptions)[0x00039] in / Users / builder / jenkins / workspace / xamarin-macios / xamarin-macios / external / mono / mcs / class /referencesource/mscorlib/system/activator.cs:206
System.Activator.CreateInstance(System.Type type、System.Boolean nonPublic)[0x00000] in / Users / builder / jenkins / workspace / xamarin-macios / xamarin-macios / external / mono / mcs / class / referencesource / mscorlib / system / activator.cs:190
/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/activator.csのSystem.Activator.CreateInstance(System.Type type)[0x00000] :134
Xamarin.Forms.ElementTemplate + <> c__DisplayClass4_0。<。ctor> b__0()[0x00000]でd:agent1sXamarin.Forms.CoreElementTemplate.cs:26
Xamarin.Forms.ElementTemplate.CreateContent()[0x00031]のd:agent1sXamarin.Forms.CoreElementTemplate.cs:82
Xamarin.Forms.Internals.DataTemplateExtensions.CreateContent(Xamarin.Forms.DataTemplate self、System.Object item、Xamarin.Forms.BindableObject container)[0x00001] in d:agent1sXamarin.Forms.CoreDataTemplateExtensions.cs:19
Xamarin.Forms.ShellContent.Xamarin.Forms.IShellContentController.GetOrCreateContent()[0x00036]のd:agent1sXamarin.Forms.CoreShellShellContent.cs:61
Xamarin.Forms.Platform.iOS.ShellSectionRootRenderer.LoadRenderers()[0x00024]のd:agent1sXamarin.Forms.Platform.iOSRenderersShellSectionRootRenderer.cs:145
Xamarin.Forms.Platform.iOS.ShellSectionRootRenderer.ViewDidLoad()[0x0003b]のd:agent1sXamarin.Forms.Platform.iOSRenderersShellSectionRootRenderer.cs:63
at(ラッパー管理からネイティブ)UIKit.UIApplication.UIApplicationMain(int、string []、intptr、intptr)
UIKit.UIApplication.Main(System.String [] args、System.IntPtrプリンシパル、System.IntPtrデリゲート)[0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.2.2/src/Xamarin.iOS /UIKit/UIApplication.cs:86
UIKit.UIApplication.Main(System.String [] args、System.StringprincipalClassName、System.StringdelegateClassName)[0x0000e]の/Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.2.2/src/Xamarin.iOS /UIKit/UIApplication.cs:65
CarouselGallery.iOS.Application.Main(System.String [] args)[0x00001]の/Users/jfversluis/Downloads/CarouselGallery-master/CarouselGallery/CarouselGallery.iOS/Main.cs:17
@rmarinho
ping。 これについて何か進展はありますか? このバグがあると、CarouselViewは使用できなくなります。
@ezと話し合った後、これはCollectionViewでも確認する必要がある問題だと思います。これを修正する方法を見ていきます。
回避策として、スタックレイアウトに配置すると機能します
回避策として、スタックレイアウトに配置すると機能します
しかし、 @ davidortinauのサンプルコードでは、CarouselViewはすでにStackLayout内に配置されています。 あなたの回避策はどのように機能するはずですか?
@samhoutsこれについて何か進展はありますか? 私にとって非常に大きな問題atm
これに対する修正も見たいです。
CollectionViewでこの問題が修正されるのを楽しみにしています。 両方のスペースの問題が同時に対処されているように聞こえます。 2つのCollectionViewを含む私のレイアウトが、期待どおりにレイアウトされなかった理由を理解するために、多くの時間を費やしました。
2019年11月24日オープン...何かニュースはありますか?
@samhouts
このバグがあると、CarouselViewは使用できなくなります。 これは修正される予定ですか?
Xamarinチーム、これらのコンポーネントは現在、実稼働環境では使用できません。 この号は2019年後半から公開されています。何が起こっているのですか? それらが壊れていて修正されない場合は、最終的に機能しない何かに時間を浪費するのではなく、開発者に知らせるためにそれらを廃止してください。 それらが廃止された場合、それらが機能しないか、修正されない可能性があることが予想されるため、より良いです。
ありがとう!
ご存知のとおり、CollectionViewをどうしても使用する必要がある場合は、要素ビューのサイズ変更をサブスクライブする非常に汚いハックを使用して、CollectionViewの高さを手動で適切に設定できます。 しかし、私もこれが箱から出して機能することを望んでいます。 :)
その間、私はこのようなバグの回避コードをたくさん書いているので、クロスプラットフォームの利点全体が溶けてしまいます...無限の高さのサイズ設定を避けるためにCarouselViewで固定のHeightRequestを使用しましたが、これは新しい原因になりますトラブル。
これについて何か一言? CollectionViewまたはCarouselViewを使用するたびに、この問題に悩まされ、カスタマーリピーターまたはバインド可能なレイアウトに頼らなければなりません。 特にCollectionViewがプレビューから外れているため、これが高い優先度を与えられていないのは残念です。
これを修正してください。これは多くの影響を及ぼしています。同じページにコレクションビューとカルーセルビューがあり、これは私を殺しています。
ええ、私はここで同じ問題を抱えています
誰かがこの問題の回避策を見つけましたか?
最も参考になるコメント
その間、私はこのようなバグの回避コードをたくさん書いているので、クロスプラットフォームの利点全体が溶けてしまいます...無限の高さのサイズ設定を避けるためにCarouselViewで固定のHeightRequestを使用しましたが、これは新しい原因になりますトラブル。