2015-02-23 88 views
1

我的新手,当谈到xamarin,也是在XAML,我只是想问问如何添加填充我viewcell里面下面是我的代码添加填充内ViewCell xamarin

<TableView> 
     <TableRoot> 
      <TableSection Title = "Basic information"> 
       <EntryCell Label = "First name: " Placeholder = "Required" /> 
       <EntryCell Label = "Middel name: " Placeholder = "Optional" /> 
       <EntryCell Label = "Last name: " Placeholder = "Required" /> 
       <ViewCell> 
        <Picker x:Name="genderPicker" Title = "Select gender"></Picker> 
       </ViewCell> 
      </TableSection> 
     </TableRoot> 
</TableView> 

我要的是在此代码中添加一点点填充。

  ![<ViewCell> 
       <Picker x:Name="genderPicker" Title = "Select gender"></Picker> 
      </ViewCell>][1] 

这就是它的样子,所以我只是想在我的选取器视图中添加一些左右空间。

http://i.stack.imgur.com/89qt9.png

回答

2

像这样的东西应该工作正常:

<Picker x:Name="genderPicker" 
    Title = "Select gender" 
    Padding="left, top, right, bottom"> 
    </Picker> 

有左,上,右,下,你希望值。更多信息here

0

在ViewCell中添加一个支持填充的StackLayout或任何其他布局子类型。然后,您可以使用布局属性来调整拾取器。

<ViewCell> 
    <StackLayout Padding="10,0,0,0" HorizontalOptions="FillAndExpand"> 
    <Picker HorizontalOptions="CenterAndExpand" > 
     <Picker.Items> 
     <x:String>Disabled</x:String> 
     <x:String>5 minutes</x:String> 
     </Picker.Items> 
     <Picker.SelectedIndex>0</Picker.SelectedIndex> 
    </Picker> 
    </StackLayout> 
</ViewCell> 

与CSS或Android浏览,您可以在Xamarin.Forms工作时调整控件本身,你会处理大部分使用父布局的填充。