Widget layout xml

yuraxyurax RUMember ✭✭
edited July 2018 in Xamarin.Android

I have Windows Phone UserControl with XAML:

<Grid x:Name="LayoutRoot" Height="336" Width="691" Background="#FBF0D9">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition x:Name="rowFooter" Height="100"></RowDefinition>
    </Grid.RowDefinitions>

    <TextBlock x:Name="tbContent" 
               Foreground="#5F4B32"                                                        
               TextWrapping="Wrap"                   
               Margin="12, 5, 12, 5" />

    <Border Background="#00727B" Grid.Row="1">
        <Image x:Name="iImage1" Width="100" HorizontalAlignment="Left" />
    </Border>
    <TextBlock x:Name="tbTitle" Grid.Row="1"
               Foreground="White"
               HorizontalAlignment="Right"
               Margin="110, 27, 12, 7" />
</Grid>

How I can convert this code to Android Widget xml layout?

Posts

  • YorkGoYorkGo CNMember, Xamarin Team Xamurai

    Help convert it to Android .axml layout file:

    <?xml version="1.0" encoding="utf-8"?>
    <GridLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:rowCount="2"
        android:background="#FBF0D9"
        android:id="@+id/LayoutRoot">
    
        <TextView
            android:layout_row="0"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_rowWeight="1"
            android:textColor="#5F4B32"
            android:id="@+id/tbContent"
            android:layout_marginLeft="12dp"
            android:layout_marginTop="5dp"
            android:layout_marginRight="12dp"
            android:layout_marginBottom="5dp"
            android:text="tbContent text"
            android:singleLine="false"
            />
    
        <LinearLayout
            android:layout_row="1"
            android:layout_rowWeight="0"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:id="@+id/rowFooter"
            android:background="#00727B"
            >
    
            <ImageView
                android:id="@+id/iImage1"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:background="@drawable/york"
                android:layout_gravity="left"
                />
    
            <TextView
                android:gravity="right"
                android:textColor="@android:color/white"
                android:id="@+id/tbTitle"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="tbTitle Text"
                android:layout_marginLeft="110dp"
                android:layout_marginTop="27dp"
                android:layout_marginRight="12dp"
                android:layout_marginBottom="7dp"/>
        </LinearLayout>
    
    </GridLayout>
    
Sign In or Register to comment.