第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

滾動時列表視圖項(xiàng)目文本發(fā)生變化

滾動時列表視圖項(xiàng)目文本發(fā)生變化

C#
慕工程0101907 2023-06-25 13:53:41
我有一個列表視圖,其中綁定了標(biāo)簽和圖像等多個數(shù)據(jù),并且我的框架中有該列表,因此當(dāng)列表大小大于 10 個項(xiàng)目左右時,滾動時我的圖像會自行調(diào)整大小,標(biāo)簽文本開始隱藏取消隱藏。這是我的 xaml:? ? ? ? ? ? <ListView?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?x:Name="list"?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SelectionMode="None"?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SeparatorVisibility="None"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HasUnevenRows="True"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?IsVisible="False"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?BackgroundColor="Transparent"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ItemTapped="List_ItemTapped"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CachingStrategy="RetainElement"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? >? ? ? ? ? ? ? ? ? ? ? ? ? ? <ListView.ItemTemplate>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <DataTemplate>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <ViewCell>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <Frame Padding="10" Margin="10">? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <Grid>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <Grid.RowDefinitions>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <RowDefinition?? ? ? ? Height="Auto" />? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <RowDefinition Height="*"?? ? ? ? />? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? </Grid.RowDefinitions>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <Grid.ColumnDefinitions>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <ColumnDefinition?? ? ? ? Width="Auto" />? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <ColumnDefinition?? ? ? ? Width="*" />當(dāng)我開始滾動它時,文本開始隱藏,取消隱藏其大小變化,十字圖像變小或變大,并且在刪除列表項(xiàng)時,所有文字消失
查看完整描述

3 回答

?
慕少森

TA貢獻(xiàn)2019條經(jīng)驗(yàn) 獲得超9個贊

這種重新渲染列表單元格的行為通常與ListView緩存策略有關(guān)。它定義了單元格的緩存方式,并嘗試在加載大量數(shù)據(jù)時提高性能,但也可能會影響正確的顯示。嘗試搞亂CachingStrategy.?根據(jù)過去的經(jīng)驗(yàn),將其設(shè)置為“RecycleElement”可以解決渲染問題。


查看完整回答
反對 回復(fù) 2023-06-25
?
皈依舞

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超3個贊

嘗試這個


                 <ListView 

                       x:Name="list" 

                       SelectionMode="None" 

                       HorizontalOptions="FillAndExpand"

                       VerticalOptions="FillAndExpand"

                       SeparatorVisibility="None"

                       HasUnevenRows="True"                     

                       BackgroundColor="Transparent"

                       CachingStrategy="RetainElement"

                      >

        <ListView.ItemTemplate>

            <DataTemplate>

                <ViewCell>

                    <Frame Padding="10" Margin="10">


                        <Grid>

                            <Grid.RowDefinitions>

                                <RowDefinition 

                                 Height="Auto" />

                                <RowDefinition Height="Auto" 

                                        />

                            </Grid.RowDefinitions>

                            <StackLayout Grid.Row="0" Orientation="Horizontal" HorizontalOptions="FillAndExpand" >



                                <Label                                                         

                                                Text="{Binding Note}" 

                                                HorizontalOptions="StartAndExpand"  

                                                TextColor="Black"  

                                                FontSize="Small"

                                                FontFamily=" 

                                                {StaticResource BoldFont}"

                                                FontAttributes="Bold">

                                </Label>

                            <ImageButton

                                          

                                                 HorizontalOptions="EndAndExpand"

                                                 WidthRequest="22"

                                                 HeightRequest="22"

                                                 Padding="6"

                                                 Margin="0,0,0,0"

                                                 Clicked="btndelete"  

                                                 AbsoluteLayout.LayoutBounds="0,0,1,1"    

                                                 BackgroundColor="Transparent"

                                                Source="close.png">

                            </ImageButton>





                            </StackLayout>

                            

 


                            <StackLayout Grid.Row="1" Orientation="Horizontal" HorizontalOptions="FillAndExpand">

                                <Label 

                                                    

                                                    Text="{Binding 

                                                    NOfQuestions}"

                                                    HorizontalOptions="StartAndExpand" 

                                                    FontSize="12"

                                                    FontFamily=" 

                                                    {StaticResource Regular}"

                                                    TextColor="White">


                                </Label>

                                <Label 

                                                  

                                                    Margin="15,0,0,0"    

                                                    Text="{Binding 

                                                    NOfDigits}"

                                                    HorizontalOptions="CenterAndExpand"

                                                    FontSize="12"

                                                    FontFamily=" 

                                                   {StaticResource Regular}"

                                                    TextColor="White">


                                </Label>

                            </StackLayout>

                

                        </Grid>


                    </Frame>

                </ViewCell>


            </DataTemplate>

        </ListView.ItemTemplate>

    </ListView>



查看完整回答
反對 回復(fù) 2023-06-25
?
縹緲止盈

TA貢獻(xiàn)2041條經(jīng)驗(yàn) 獲得超4個贊

當(dāng)您在 a 中有自定義單元格時,ListView建議使用CachingStrategy


ListView是顯示數(shù)據(jù)的強(qiáng)大視圖,但它有一些局限性。使用自定義單元格時,滾動性能可能會受到影響,特別是當(dāng)它們包含深度嵌套的視圖層次結(jié)構(gòu)或使用需要復(fù)雜測量的某些布局時。


Xamarin.Forms 的 XAML 為與緩存策略參數(shù)對應(yīng)的不存在的屬性提供 XAML 屬性:


<ListView CachingStrategy="RecycleElement" >

    <ListView.ItemTemplate>

        <DataTemplate>

            <ViewCell>

                <!-- ... -->

            </ViewCell>

        </DataTemplate>

    </ListView.ItemTemplate>

</ListView>


查看完整回答
反對 回復(fù) 2023-06-25
  • 3 回答
  • 0 關(guān)注
  • 134 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號