locked
TableSection title not shown RRS feed

  • Question

  • User229618 posted

    Hi,

    I Used following code to create a table with two table sections:

                var section = new TableSection("Ring")
                {
                    new SwitchCell {Text = "New Voice Mail"},
                    new SwitchCell {Text = "New Mail", On = true}
                };
                var section2 = new TableSection("Ring2")
                {
                    new SwitchCell {Text = "New Voice Mail"},
                    new SwitchCell {Text = "New Mail", On = true}
                };
    
                var table = new TableView
                {
                    Root = new TableRoot
                            {
                                section,
                                section2
                            },
                    Intent = TableIntent.Settings,
                };
    

    The TableSection titles "Ring" and "Ring2" are not shown, just an empty line. The SwitchCells are shown correctly. I created a new project as mine( Forms Shared) and tested this code, and it works fine. It must be something wrong with my app. i tried to create this in several ContentPages in my app, but it doesnt work. I hope someone can give me a tip, which brings me on the right way.

    Its only an android. on iOS device it works fine.

    Thursday, October 13, 2016 12:55 PM

All replies

  • User222078 posted

    Did you figure out a solution to this? I'm running into the same problem.

    Friday, December 2, 2016 12:51 AM
  • User288433 posted

    Anybody figure this out? I'm seeing this only on Galaxy S5 devices. Other Android devices work ok.

    Tuesday, January 3, 2017 7:48 PM
  • User182206 posted

    Having the same problem here, anyone found out what is going on? Happening on some Galaxy tablets too. It was working fine in previous Forms versions (before 2.3.3). Seems to be related with the Accent color, I am using the Color.Accent in some other places too, and everywhere it is invisible(or transparent).

    Wednesday, January 4, 2017 3:06 PM
  • User193155 posted

    Run into the same problem, on some Samsung devices only. Anybody figured out?

    Thursday, January 5, 2017 5:09 PM
  • User4602 posted

    Yes.

    The problem is that Color.Accent is not working correctly on some platforms.

    static Color GetAccentColor() { Color rc; using (var value = new TypedValue()) { if (Context.Theme.ResolveAttribute(global::Android.Resource.Attribute.ColorAccent, value, true)) // Android 5.0+ { rc = Color.FromUint((uint)value.Data); } else if (Context.Theme.ResolveAttribute(Context.Resources.GetIdentifier("colorAccent", "attr", Context.PackageName), value, true)) // < Android 5.0 { rc = Color.FromUint((uint)value.Data); } else // fallback to old code if nothing works (don't know if that ever happens) { // Detect if legacy device and use appropriate accent color // Hardcoded because could not get color from the theme drawable var sdkVersion = (int)Build.VERSION.SdkInt; if (sdkVersion <= 10) { // legacy theme button pressed color rc = Color.FromHex("#fffeaa0c"); } else { // Holo dark light blue rc = Color.FromHex("#ff33b5e5"); } } } return rc; }

    The Android 5.0 part is running event on 4.4.2 platforms and returning a wrong color. I think thay must use a Build.SdkInt test here.

    Regards,

    Diego

    Friday, March 10, 2017 1:23 PM
  • User4602 posted

    I just created https://bugzilla.xamarin.com/show_bug.cgi?id=53222

    Friday, March 10, 2017 2:19 PM
  • User184052 posted

    I did a workaround while the bug isn't fixed: Example:

    private EntryCell entryCellA = null;
    private EntryCell entryCellB = null;
    
    var Table = new TableView
    {
        HorizontalOptions = LayoutOptions.FillAndExpand,
        Intent = TableIntent.Form,
        Root = new TableRoot()
        {
            Title = "Root",
        }
     };
    
    Table.Root.Add(new TableSection { new TextCell { Text = "Your Text", TextColor = Color.Black } }); //workarround
    Table.Root[0].Add(entryCellA = new EntryCell() {Label = "Text 1" });
    Table.Root[0].Add(entryCellA = new EntryCell() { Label = "Text 2" });
    
    Thursday, May 4, 2017 6:40 PM
  • User267719 posted

    same issue, what version fix this bug?

    Monday, May 8, 2017 3:59 PM