2017-06-02 118 views
0

我想在TableView中添加ViewCell和SwitchCell。我想知道什么是SwitchCell的默认边距,所以我可以使TableView看起来很漂亮。你可以帮我吗?Xamarin Forms TableView默认填充

<TableView Intent="Form"> 
     <TableRoot> 
      <TableSection> 
       <ViewCell> 
        <StackLayout Padding="?, ?, ?, ?"> 
         <!-- Something--> 
        </StackLayout> 
       </ViewCell> 
       <SwitchCell Text="Something"/> 
      </TableSection> 
     </TableRoot> 
    </TableView> 
+0

这取决于你的设计。尝试把10,5,10,5 – Pratik

+0

@PratikPatel好吧我会尝试,但实际上问题是我的switchcell的标签被截断,所以我使用ViewCell,而你有任何解决方案吗? –

+0

您可以使用Grid而不是ViewCell。可能对你有帮助。检查我的答案 – Pratik

回答

2

您可以使用Grid而不是ViewCell。试试这样的

<TableView Intent="Form"> 
     <TableRoot> 
      <TableSection> 
       <Grid> 
        <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="*" /> 
        <ColumnDefinition Width="Auto" /> 
        </Grid.ColumnDefinitions> 
        <StackLayout Grid.Column="0" Padding="?, ?, ?, ?"> 
         <!-- Something--> 
        </StackLayout> 
        <SwitchCell Grid.Column="1" Text="Something"/> 
       </Grid>      
      </TableSection> 
     </TableRoot> 
    </TableView>