将Label和PickerView放在TableView的同一行上

这是在Xamarin的C#中。我正在使用跨平台的UI代码。类似于仅使用.XAML文件,但我在代码中进行操作。


     var viewPickerAutoSaveTimer = new StackLayout();

        viewPickerAutoSaveTimer.Orientation = StackOrientation.Horizontal;

        viewPickerAutoSaveTimer.Padding = 13;



        Label labelAutoSaveTimer = new Label()

        {

            VerticalOptions = LayoutOptions.Center,

            Text = "Auto Save Timer"

        };


        Picker pickerAutoSaveTimer = new Picker()

        {

            HorizontalOptions = LayoutOptions.FillAndExpand,

            VerticalOptions = LayoutOptions.Center,

            SelectedIndex = 1,


            Items = { "1", "2", "3" }

        };




    viewPickerAutoSaveTimer.Children.Add(labelAutoSaveTimer);

    viewPickerAutoSaveTimer.Children.Add(pickerAutoSaveTimer);

接下来,我有以下代码。


                new TableSection ("AUTO SAVE") {

                    new SwitchCell {

                        Text = "Enable Auto Save:"

                    },

                    new ViewCell

                    {

                      View = viewPickerAutoSaveTimer

                    }



                },

这是结果的屏幕截图-

http://img.mukewang.com/60a9ba7f0001abf906050946.jpg

“自动保存计时器”旁边的行应在选择器上显示所选项目...但是不会!


忽然笑
浏览 184回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP