Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

iOS SearchBar in RelativeLayout Not Displaying

$
0
0

I'm trying to add a SearchBar into a RelativeLayout in Xamarin.Forms. It displays correctly on Android, but not on iOS. Has anyone run into this issue before, and know how to fix it? Here's the code snippet:

public class SearchPage : ContentPage
{
    private SearchBar searchBar;

    public SearchPage ()
    {
        searchBar = new SearchBar() {
            Placeholder = "Search"
        };
        var layout = new RelativeLayout();
        layout.Children.Add(searchBar,
            Constraint.Constant(0),
            Constraint.RelativeToParent((parent) => {
                return parent.Y + 200;
            }));
        }));
        Content = layout;
    }
}

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>