Bug 26656 - [Android] Setting ListView Divider to transparent does not work
Summary: [Android] Setting ListView Divider to transparent does not work
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-02-02 16:13 UTC by John Miller [MSFT]
Modified: 2016-04-08 19:07 UTC (History)
8 users (show)

Tags: AC
Is this bug a regression?: ---
Last known good build:


Attachments
TableViewRenderer regression (377.99 KB, image/png)
2015-02-26 13:36 UTC, CraigD
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description John Miller [MSFT] 2015-02-02 16:13:59 UTC
**Overview:**

   Styling and customizing a ListView divider does not work. 

**Steps to Reproduce:**

   Try adding a theme style like this to the Android app project Values folder (styles.xml):

<resources>
  <style name="Theme.MyTheme" parent="@android:Theme.Material">
           <item name="android:listViewStyle">@style/awesomeListViewStyle</item>
    </style>
	<style name="awesomeListViewStyle" parent="@android:style/Widget.ListView">
		<item name="android:listDivider">@android:color/transparent</item>
    </style>
</resources>

Make sure to use it in the MainActivity:

> Theme = "@style/Theme.MyTheme"

Have also tried this:

>protected override Android.Views.View GetCellCore (Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context >context)
>{

>var list = parent as Android.Widget.ListView;
>if (list != null && list.DividerHeight == 0) {
>list.DividerHeight = 0;
>}
>return base.GetCellCore (item, convertView, parent, context);
>}

**Actual Results:**

   The divider still renders on Android in between cells in a ListView

**Expected Results:**

   No divider

**Build Date & Platform:**

   XF 1.3.2.6316
   XA 4.20
Comment 1 John Miller [MSFT] 2015-02-02 16:56:45 UTC
The same issue applies for GroupHeaderTemplate, etc.
Comment 2 Andrei.N 2015-02-24 11:28:47 UTC
looking with disassembler it seems the separator is a child view created with height of 1 pixel with color hardcoded.

internal sealed class ListViewAdapter
{
      public override View GetView(int position, View convertView, ViewGroup parent)
      {
               ….
  View view = new View(this.context);
               view.set_LayoutParameters(new LinearLayout.LayoutParams(-1, 1));
               childAt = view;
               linearLayout.AddView(childAt);

               …..
               childAt.SetBackgroundResource(ListViewAdapter.dividerHorizontalDarkId);
       }
}

But maybe I’m mistaken?

Any reason why not use the native's ListView separator instead of creating the separator?
Comment 3 CraigD 2015-02-26 13:36:36 UTC
Created attachment 10060 [details]
TableViewRenderer regression

Setting 

`tableView.DividerHeight = 0;`

in an Android TableViewRenderer does not affect the divider's appearance in Xamarin.Forms 1.3.4 (the divider is still visible)

This looks like a regression, it definitely worked in Xamarin.Forms 1.2.2 (the divider is hidden)
Comment 4 Lionel Ong 2015-09-03 20:09:02 UTC
Setting the Divider to null doesn't work neither.

We're on Xamarin.Forms 1.4.4.6392
Comment 5 Samantha Houts [MSFT] 2016-04-08 19:07:09 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team