Xamarin Android | Layout style

廉价感情. 提交于 2019-12-13 16:50:31

问题


I am trying to create this layout style but still I have no idea how to do it? is there anybody who can help me ?

I need main layout and in the layout must be on the left image view for color next will be Title with description for fill parrent and on the right side must be img.


回答1:


Here you go. I designed you left flag, title and description labels plus right image view control. Just create new .axml file and use this code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linear"
        android:orientation="vertical"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">
        <TextView
            android:id="@+id/titleTextView"
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="25dp"
            android:gravity="center_vertical"
            android:paddingTop="5dp"
            android:text="Title"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="30dp" />
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" >
            <TextView
                android:id="@+id/descriptionTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="25dp"
                android:height="30dp"
                android:text="Description"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </RelativeLayout>
    </LinearLayout>
    <RelativeLayout
        android:id="@+id/flagLayout"
        android:layout_width="15dp"
        android:layout_height="70dp"
        android:background="#5416B4"
        android:layout_alignParentLeft="true" />
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/imageView"
            android:layout_width="90dp"
            android:layout_height="70dp"
            android:layout_alignParentRight="true"
            android:background="#ffa500" />
    </RelativeLayout>
</RelativeLayout>

Final result looks like this:



来源:https://stackoverflow.com/questions/44466475/xamarin-android-layout-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!