#開発環境
Visual Studio 2017 Community 15.9.4
Xamarin.Forms 3.4.0.1009999
#やりたいこと
1つのページに2つのListViewを置いてどちらもスクロールさせたい。
#コード
xaml
1<?xml version="1.0" encoding="utf-8" ?> 2<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 3 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 4 x:Class="App.History"> 5 <ContentPage.Content> 6 <AbsoluteLayout> 7 <BoxView BackgroundColor="LightGray" 8 AbsoluteLayout.LayoutBounds="0,0,1,0.05" 9 AbsoluteLayout.LayoutFlags="All"/> 10 <Label Text="現在" 11 AbsoluteLayout.LayoutBounds="0,0,1,0.05" 12 AbsoluteLayout.LayoutFlags="All"/> 13 <RelativeLayout AbsoluteLayout.LayoutBounds="0,0.1,1,0.45" 14 AbsoluteLayout.LayoutFlags="All"> 15 <ListView x:Name="List1" 16 ItemsSource="{Binding}"> 17 <ListView.ItemTemplate> 18 <DataTemplate> 19 <ViewCell> 20 <StackLayout Orientation="Horizontal" 21 VerticalOptions="Start"> 22 <StackLayout Orientation="Vertical"> 23 <Label Text="{Binding Date}"/> 24 <Label Text="{Binding Address}"/> 25 </StackLayout> 26 </StackLayout> 27 </ViewCell> 28 </DataTemplate> 29 </ListView.ItemTemplate> 30 </ListView> 31 </RelativeLayout> 32 <BoxView BackgroundColor="LightGray" 33 AbsoluteLayout.LayoutBounds="0,0.525,1,0.05" 34 AbsoluteLayout.LayoutFlags="All"/> 35 <Label Text="過去" 36 AbsoluteLayout.LayoutBounds="0,0.525,1,0.05" 37 AbsoluteLayout.LayoutFlags="All"/> 38 <RelativeLayout AbsoluteLayout.LayoutBounds="0,1,1,0.45" 39 AbsoluteLayout.LayoutFlags="All"> 40 <ListView x:Name="List2" 41 ItemsSource="{Binding}"> 42 <ListView.ItemTemplate> 43 <DataTemplate> 44 <ViewCell> 45 <StackLayout Orientation="Horizontal" 46 VerticalOptions="Start"> 47 <StackLayout Orientation="Vertical"> 48 <Label Text="{Binding Date}"/> 49 <Label Text="{Binding Address}"/> 50 </StackLayout> 51 </StackLayout> 52 </ViewCell> 53 </DataTemplate> 54 </ListView.ItemTemplate> 55 </ListView> 56 </RelativeLayout> 57 </AbsoluteLayout> 58 </ContentPage.Content> 59</ContentPage>
#知りたいこと
上記コードを実行すると2つのListViewが表示されますが、どちらもスクロールが出来ません。
そのため、6件以上データが登録されるとその先が見えなくなってしまいます。
どうにかして両方ともスクロールバーを出してスクロールさせることは出来ないでしょうか?
ListViewが無理なようであれば最悪別のコントロールの使用を検討したいのですが、その際のおすすめなどはありますでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2019/01/12 19:14