You might try using BoxView
// sl is a StackLayout
sl.Children.Add(new BoxView() { Color = Color.Black, WidthRequest = 100, HeightRequest = 2 });
although in my test, the width request is not being followed. This may be a bug, or other settings might be interfering with it.