Xamarin.forms: Frame is missing elevation and shadow inside ListView

Created on 10 Nov 2018  路  11Comments  路  Source: xamarin/Xamarin.Forms

Description

Frame shadow and elevation looks different when upgrade from 3.2 to 3.3 or 3.4 pre when used inside ListView. It looks more flat and very similar to #3532. Tested the issue on Android emulator 8.0 and also on device HTC U11 with Android 8.0

Steps to Reproduce

  1. Create Xamarin.Forms project (Blank, .NET Standard, Android)
  2. Use Xaml:
    <StackLayout Orientation="Vertical"> <Frame Padding="1" HasShadow="True"> <Label Text="Test" /> </Frame> <Frame Padding="1" HasShadow="True"> <Label Text="Test" /> </Frame> <ListView HasUnevenRows="True" ItemsSource="{Binding ListItems}" SeparatorVisibility="None"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid Margin="5"> <Grid.RowDefinitions> <RowDefinition Height="50" /> </Grid.RowDefinitions> <Frame Padding="1" HasShadow="True"> <Label Text="{Binding}" /> </Frame> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout>

Expected Behavior

Frame has visible shadow and elevation

Actual Behavior

Frame looks flat and does not have a shadow when placed inside ListView

Basic Information

  • Version with issue: 3.3.0.967583, 3.3.0.967583, both of the 3.4 pre versions
  • Last known good version: 3.2.0.871581
  • IDE: Visual Studio Enterprise 2017 15.8.9
  • Platform Target Frameworks:

    • Android: 8.0

  • Nuget Packages: default

Screenshots

All fine on 3.2
obrazek

Elevation and shadow missing inside ListView on 3.3+
obrazek

3.3.0 listview 5 help wanted low regression inactive Android up-for-grabs

Most helpful comment

Still getting this issue on the latest version of XF 4.1. on Android. I tried setting the Visual property of the frame to Material no luck as well as a couple of the workarounds here with setting the background. Anybody else had any luck with a workaround for this issue.

All 11 comments

Verified as reported.
image
App43.zip

I see the same no shadow effect when inside a scrollview. only on pre Oreo devices

not excited to see that one of the most used ui elements have such low priority...

agree :/ I tested it on 3.5 and the issue is still there

even tested this workaround to no avail on 3.5
https://alexdunn.org/2018/06/06/xamarin-tip-dynamic-elevation-frames/

adding a margin on the frame seems to have fixed this issue. The scrollview is probably clipping the shadow area.

adding a margin on the frame seems to have fixed this issue. The scrollview is probably clipping the shadow area.

I can confirm this fixed it for me as well. I applied a margin of 5 just to test. Thanks @jeromemanzano

On android using the Visual="Material" on frames fixes all my issues. So a look on that renderer might help fixing this problem. If youre app wants to support kitkat MaterialREnderers are not available though.

Still getting this issue on the latest version of XF 4.1. on Android. I tried setting the Visual property of the frame to Material no luck as well as a couple of the workarounds here with setting the background. Anybody else had any luck with a workaround for this issue.

I got issue on frame inside Listview , frame shows shadow initially but when i scrolls up or down then the item which was scrolled out from screen and again came back lost shadow .

don't subscribe, I'm getting over 100 emails a day from this subscription

Was this page helpful?
0 / 5 - 0 ratings