有没有一种方法可以在Xamarin中以编程方式在其子级中设置Flex-Layout的Grow属性

我正在尝试以编程方式创建布局,但似乎无法弄清楚如何在其子级之一上设置Flexlayout的Grow属性

为澄清起见,我想以编程方式在Flexlayout的一个子级上应用“增长”,因此它占用了布局中的所有剩余空间

这是我要在C#中尝试执行的Xaml代码的示例

<StackLayout x:Name="ContainerLayout">
      <FlexLayout Direction="Row">
           <Editor Text="test"
                   FontSize="Large"
                   FlexLayout.Grow="1"/>

      <ImageButton Source="add_btn"
                   HeightRequest="40"
                   WidthRequest="40"
                   IsVisible="True"
                   Clicked="Translation_Clicked"/>
      <ImageButton Source="remove_btn"
                   HeightRequest="40"
                   WidthRequest="40"
                   IsVisible="False"
                   Clicked="Translation_Clicked"/>
       </FlexLayout>
</StackLayout>

我想在运行时添加一些Flexlayout

到目前为止我的代码

FlexLayout flexLayout = new FlexLayout();
            flexLayout.Direction = FlexDirection.Row;

            Editor editor = new Editor();
            editor.FontSize = Device.GetNamedSize(NamedSize.Large,typeof(Editor));
    //Want to set Flexlayout.Grow to 1 here,so the editor takes the left space

ContainerLayout.Children.Add(flexLayout);

zhangshaodan123 回答:有没有一种方法可以在Xamarin中以编程方式在其子级中设置Flex-Layout的Grow属性

您显然需要像Grid.RowSpan一样使用它。

fptr=fopen(argv[1],"r"); if(fptr==NULL) { printf(" File does not exist or can not be opened."); } else { while((ch = getc(fptr)) != EOF) { if(ch == '\n') wrd++; } fclose(fptr); fptr=fopen(argv[1],"r"); char *str[wrd]; int i=0; while((ch = fgetc(fptr)) != EOF) { if(ch == '\n') { printf("\n is in the %d",i); i++; } else { cToStr[0] = ch; printf("%c",ch); strcat(b[i],cToStr); } } printf("%d",wrd); display(wrd,b,argv[2]); fclose(fptr); } return 0; } ==10790== ==10790== ==10790== 10000 errors in context 24 of 34: ==10790== Invalid write of size 1 ==10790== at 0x400B3D: main (Lex.c:61) ==10790== Address 0x1ffec2ea80 is on thread 1's stack ==10790== in frame #0,created by main (Lex.c:53) ==10790== ==10790== ERROR SUMMARY: 13544 errors from 34 contexts (suppressed: 0 from 0)

本文链接:https://www.f2er.com/3158616.html

大家都在问