Quantcast
Viewing all articles
Browse latest Browse all 89864

How can I make platform specific RelativeLayout.XConstraint in XAML?

I have an activity indicator that isn't aligning the same on iOS/Android. Here is what I currently have that does't work.

<ContentView>
    <RelativeLayout>
        <Button x:Name="LoginBtn" Text="{Extensions:TranslateExtension Text=Join}" WidthRequest="300" />
        <ActivityIndicator x:Name="actIndicator" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
            <ActivityIndicator.RelativeLayout.XConstraint>
                <OnPlatform x:TypeArguments="Constraint" 
                    iOS="{ConstraintExpression Type=RelativeToView, Property=Width, ElementName=LoginBtn, Factor=0.47}" 
                    Android="{ConstraintExpression Type=RelativeToView, Property=Width, ElementName=LoginBtn, Factor=0.42}" />
            </ActivityIndicator.RelativeLayout.XConstraint>
            <ActivityIndicator.RelativeLayout.YConstraint>
                <OnPlatform x:TypeArguments="Constraint" 
                    iOS="{ConstraintExpression Type=RelativeToView, Property=Height, ElementName=LoginBtn,Factor=0.28}" 
                    Android="{ConstraintExpression Type=RelativeToView, Property=Height, ElementName=LoginBtn,Factor=0.025}" />
            </ActivityIndicator.RelativeLayout.YConstraint>
        </ActivityIndicator>
    </RelativeLayout>
</ContentView>

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>