我正在尝试将我的XAML页面包装在滚动视图中,页面在它自己的工作正常(android 4.4到8)但是当我介绍滚动时,我一遍又一遍地得到以下错误设备日志:
Time Device Name Type PID Tag Message
04-13 10:20:07.633 Samsung SM-T230 Error 144 BufferQueue [com.glmobileapp/md5dc496626c370b103ce86ee6c362b5772.MainActivity] dequeueBuffer: min undequeued buffer count (1) exceeded (dequeued=2 undequeudCount=0)
以及输出窗口中的以下内容:
04-13 10:27:10.966 D/skia ( 1117): --- allocation failed for scaled bitmap
04-13 10:27:11.026 I/dalvikvm-heap( 1117): Clamp target GC heap from 516.602MB to 512.000MB
04-13 10:27:11.026 D/dalvikvm( 1117): GC_FOR_ALLOC freed <1K, 1% free 511501K/513364K, paused 52ms, total 52ms
04-13 10:27:11.026 I/dalvikvm-heap( 1117): Forcing collection of SoftReferences for 22473160-byte allocation
04-13 10:27:11.076 I/dalvikvm-heap( 1117): Clamp target GC heap from 516.602MB to 512.000MB
04-13 10:27:11.076 D/dalvikvm( 1117): GC_BEFORE_OOM freed <1K, 1% free 511500K/513364K, paused 56ms, total 56ms
04-13 10:27:11.076 E/dalvikvm-heap( 1117): Out of memory on a 22473160-byte allocation.
04-13 10:27:11.076 I/dalvikvm( 1117): "Thread-7288" prio=10 tid=15 RUNNABLE
04-13 10:27:11.076 I/dalvikvm( 1117): | group="main" sCount=0 dsCount=0 obj=0x41e27160 self=0x815faa88
04-13 10:27:11.076 I/dalvikvm( 1117): | sysTid=1176 nice=-11 sched=0/0 cgrp=apps handle=-2103463040
04-13 10:27:11.076 I/dalvikvm( 1117): | state=R schedstat=( 4785797128 1283386243 1816 ) utm=437 stm=41 core=3
04-13 10:27:11.076 I/dalvikvm( 1117): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
04-13 10:27:11.076 I/dalvikvm( 1117): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:683)
04-13 10:27:11.076 I/dalvikvm( 1117): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:513)
04-13 10:27:11.076 I/dalvikvm( 1117): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:541)
04-13 10:27:11.076 I/dalvikvm( 1117): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:571)
04-13 10:27:11.076 I/dalvikvm( 1117): at dalvik.system.NativeStart.run(Native Method)
我看到缩放的位图&#39;提到,我只有一个大png。 知道如何进行调试/修复吗?
更新:
我用ffimageloading替换了图像:CachedImage,它不再破坏应用程序,但它现在显示一个空白屏幕
XAML:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="gl_mobile_app.Views.Article.ArticlePage"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
xmlns:local="clr-namespace:gl_mobile_app.Views.Templates;assembly=gl_mobile_app"
xmlns:ratio="clr-namespace:gl_mobile_app;assembly=gl_mobile_app"
xmlns:custom="clr-namespace:gl_mobile_app.Controls;assembly=gl_mobile_app"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Back" Clicked="GoBack" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<ScrollView>
<Grid BackgroundColor="#ede8db" x:Name="articleGrid" Padding="0,0,0,0" >
<Grid.RowDefinitions>
<RowDefinition Height="47.5*" x:Name="grdRow0" />
<RowDefinition Height="5*" x:Name="grdRow1"/>
<RowDefinition Height="47.5*" x:Name="grdRow2" />
</Grid.RowDefinitions>
<ratio:ContentRatioContainer Grid.Row="0" x:Name="imgContainer" >
<ffimageloading:CachedImage Aspect="AspectFill" Source="KevingroveCarouselImg.png" AbsoluteLayout.LayoutBounds="1,1,1,1" AbsoluteLayout.LayoutFlags="All" x:Name="bigImg"
HeightRequest="{artina:OnOrientationDouble PortraitPhone=880, LandscapePhone=125, PortraitTablet=600, LandscapeTablet=400 }" Grid.Row="0"/>
</ratio:ContentRatioContainer>
<artina:Button Margin="10,10,10,10" x:Name="ImgZoom" Clicked="EnlargeImage" HorizontalOptions="End" VerticalOptions="Start" Image="IncreaseImageIcon.png" BackgroundColor="Transparent" HeightRequest="30" WidthRequest="30"/>
<StackLayout Grid.Row="1" Orientation="Horizontal" BackgroundColor="#ede8db" Margin="0" Padding="30,0,30,0" x:Name="iconStack" HorizontalOptions="FillAndExpand" >
<Label HorizontalTextAlignment="Center" Text="{x:Static ratio:Ingeniuus.TOILET}" Style="{StaticResource Ingeniuus}" TextColor="Black" FontSize ="{artina:OnOrientationDouble PortraitPhone=25, LandscapePhone=18, PortraitTablet=30, LandscapeTablet=20 }" />
<Label HorizontalTextAlignment="Center" Text="{x:Static ratio:Ingeniuus.WHEELCHAIR}" Style="{StaticResource Ingeniuus}" TextColor="Black" FontSize ="{artina:OnOrientationDouble PortraitPhone=25, LandscapePhone=18, PortraitTablet=30, LandscapeTablet=20 }" />
<Label x:Name="expand" HorizontalTextAlignment="Center" HorizontalOptions="EndAndExpand" Text="{x:Static ratio:FontAwesome.ARROW_DOWN}" Style="{StaticResource FontIcon}" TextColor="Black" FontSize="{artina:OnOrientationDouble PortraitPhone=25, LandscapePhone=18, PortraitTablet=30, LandscapeTablet=20 }" />
</StackLayout>
<StackLayout x:Name="TopLayout" Padding="30,0,30,0" BackgroundColor="Green">
<StackLayout Orientation="Horizontal" x:Name="MapMarker" Opacity="0.0">
<Label HorizontalTextAlignment="Center" Text="{x:Static ratio:Ingeniuus.MAP_MARKER}" Style="{StaticResource Ingeniuus}" TextColor="Black" FontSize="30" WidthRequest="{artina:OnOrientationDouble PortraitPhone=30,PortraitTablet=50, LandscapeTablet=50 }" />
<Label Text="Address" VerticalOptions="Center" HorizontalOptions="StartAndExpand" FontAttributes="Bold" />
</StackLayout>
<StackLayout x:Name="AddressStack" >
<StackLayout.Padding>
<OnIdiom x:TypeArguments="Thickness">
<OnIdiom.Phone>
<OnPlatform x:TypeArguments="Thickness" iOS="34.5,0,0,0" Android="34.5,0,0,0" />
</OnIdiom.Phone>
<OnIdiom.Tablet>
<OnPlatform x:TypeArguments="Thickness" iOS="54.5,0,0,0" Android="54.5,0,0,0" />
</OnIdiom.Tablet>
</OnIdiom>
</StackLayout.Padding>
<Label x:Name="AddressLabel" >
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="iOS" Value="HelveticaNeue-Roman" />
<On Platform="Android" Value="HelveticaNeue-Roman.otf#HelveticaNeue-Roman" />
</OnPlatform>
</Label.FontFamily>
</Label>
</StackLayout>
<StackLayout x:Name="Empty1" HeightRequest="10" />
<StackLayout Orientation="Horizontal" x:Name="clock" Opacity="0.0">
<Label HorizontalTextAlignment="Center" Text="{x:Static ratio:Ingeniuus.CLOCK}" Style="{StaticResource Ingeniuus}" TextColor="Black" FontSize="30" WidthRequest="{artina:OnOrientationDouble PortraitPhone=30,PortraitTablet=50, LandscapeTablet=50 }"/>
<Label Text="Opening Times" VerticalOptions="Center" HorizontalOptions="StartAndExpand" FontAttributes="Bold"/>
</StackLayout>
<StackLayout x:Name="OpeningTimesStack">
<StackLayout.Padding>
<OnIdiom x:TypeArguments="Thickness">
<OnIdiom.Phone>
<OnPlatform x:TypeArguments="Thickness" iOS="34.5,0,0,0" Android="34.5,0,0,0" />
</OnIdiom.Phone>
<OnIdiom.Tablet>
<OnPlatform x:TypeArguments="Thickness" iOS="54.5,0,0,0" Android="54.5,0,0,0" />
</OnIdiom.Tablet>
</OnIdiom>
</StackLayout.Padding>
<Label Grid.Row="1" x:Name="OpeningTimesLabel" >
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="iOS" Value="HelveticaNeue-Roman" />
<On Platform="Android" Value="HelveticaNeue-Roman.otf#HelveticaNeue-Roman" />
</OnPlatform>
</Label.FontFamily>
</Label>
</StackLayout>
<StackLayout x:Name="Empty2" HeightRequest="10" />
<StackLayout x:Name="txt" Opacity="1.0">
<Label x:Name="header" Style="{ StaticResource HeaderStyle }" />
<Label x:Name="description" FontSize="Large" />
</StackLayout>
<ListView x:Name="ArticleListView" CachingStrategy="RetainElement" HasUnevenRows="True" SeparatorVisibility="None" VerticalOptions="FillAndExpand" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:ArticleContentItemTemplate />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Grid>
</ScrollView>
</ContentPage.Content>
</ContentPage>
答案 0 :(得分:0)
您需要优化png,验证尺寸,因为它已经提到
Clamp target GC heap from 516.602MB to 512.000MB
你应用了大量内存,因此设备无法为应用分配更多内存,这就是
的原因