xaml - 将 InputTransparent 属性设置为 True 的 ListView 正在影响 ListView 内的按钮
问题描述
我希望我的 ListView 不可滚动和可点击,所以我设置属性 InputTransparent = true,但是,我在 ListView 内也有按钮,所以我也无法点击按钮。我尝试将按钮的 InputTransparent 属性设置为 false,但它不起作用。
有什么建议,或者您知道任何解决方法,所以我可以只显示不可点击且不可滚动的列表?
这是我的 XAML
<ListView BackgroundColor="Blue"
ItemsSource="{Binding QuestionList}"
SeparatorVisibility="None"
VerticalOptions="FillAndExpand"
InputTransparent="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<StackLayout HeightRequest="24"
WidthRequest="24"
Margin="0,0,16,0"
InputTransparent="True">
<Frame CornerRadius="20"
HasShadow="False"
Padding="0" Margin="0"
BackgroundColor="Blue"
HeightRequest="24"
WidthRequest="24">
<Label
FontSize="16"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Text="a"
TextColor="White"/>
</Frame>
</StackLayout>
<StackLayout Margin="16,0,68,0" WidthRequest="324" HorizontalOptions="FillAndExpand">
<Label Text="{Binding Question}" />
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand" Margin="0,0,30.5,0" HeightRequest="30.5">
<StackLayout Margin="0,0,12,0">
<Button HorizontalOptions="FillAndExpand" Text="YES" Command="{Binding }" WidthRequest="219" FontSize="12">
</Button>
<BoxView HeightRequest="1.52" HorizontalOptions="FillAndExpand" VerticalOptions="Start" Margin="0,-8,0,0"
</BoxView>
</StackLayout>
<StackLayout>
<Button HorizontalOptions="FillAndExpand" Text="NO" Command="{Binding }" WidthRequest="219" FontSize="12">
</Button>
<BoxView HeightRequest="1.52" HorizontalOptions="FillAndExpand" VerticalOptions="Start" Margin="0,-8,0,0">
</BoxView>
</StackLayout>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
解决方案
推荐阅读
- java - 具有无限流的 RxJava `switchOnNext`
- bash - sort:按数值比较时顺序错误
- javascript - Redux 中的 Actions 和 Reducers 有什么意义?
- opencv - OperationUnsupportedError 与 Lists clojure-java 互操作一起使用
- angular - 由于超时,加载块 77 失败,但在 Sentry 上报告错误
- c# - for循环内对数据库的异步调用
- r - 自动设置 ggplot 边距以包含 geom_text
- python - 为什么我在 Code jam 2018 “再次拯救世界”中的回答是错误的?
- python - python如何连接两个字典
- ruby-on-rails - Ruby on Rails:如何使用 AWS Cognito 池以用户身份访问 S3?