0

I'm trying to create this design shown in the picture below.

But I have no idea how do I start making it using XML. I mean, here for example the line which contain a circle and the VS word. How am I supposed to make that in XML?

Is there any idea or example?

enter image description here

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
younes
  • 21
  • 1
  • 7
  • 1
    you can use shape properties to create like the pfp layouts using xml, you can check this answered question>> https://stackoverflow.com/questions/53407101/how-to-make-thumbnail-image-with-initials-two-char-from-name-android/56564031#56564031 – AndroWaqar Apr 21 '20 at 15:03
  • 1
    let me know if you don't understand, i will create one for you like this layout – AndroWaqar Apr 21 '20 at 15:03
  • Could you please help me with your example – Ys3 Apr 21 '20 at 16:48

1 Answers1

1

I've designed your needed xml file :D I hope it helps :

here is the snapshop: Preview

At first you have to download below images and add to your drawable directory

vs image

mask image

Next is to copy below xml file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:background="#fff"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="horizontal">

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center">



            <ImageView
                android:layout_width="150dp"
                android:layout_height="150dp"
                android:background="#9C9C9C" />

            <ImageView
                android:layout_width="150dp"
                android:layout_height="150dp"
                android:background="@drawable/profilemask" />

        </RelativeLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Tyler Gilbert"
                android:textColor="#000"
                android:textSize="25dp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_margin="10dp"
                    android:background="#9C9C9C" />


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Algeria"
                    android:textColor="#000"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Level : "
                    android:textColor="#000"
                    android:textSize="20dp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="A1"
                    android:textColor="#BF360C"
                    android:textSize="20dp" />


            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

    <ImageView
        android:id="@+id/imgVS"
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:background="@drawable/vs" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#f7f7f7"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Roger Lawson"
                android:textColor="#000"
                android:textSize="25dp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_margin="10dp"
                    android:background="#9C9C9C" />


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Algeria"
                    android:textColor="#000"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Level : "
                    android:textColor="#000"
                    android:textSize="20dp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="A1"
                    android:textColor="#BF360C"
                    android:textSize="20dp" />


            </LinearLayout>

        </LinearLayout>

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center">



            <ImageView
                android:layout_width="150dp"
                android:layout_height="150dp"
                android:background="#9C9C9C" />

            <ImageView
                android:layout_width="150dp"
                android:layout_height="150dp"
                android:backgroundTint="#f7f7f7"
                android:background="@drawable/profilemask" />

        </RelativeLayout>

    </LinearLayout>

</LinearLayout>

and then, to set a dynamic correct size to the "vs" image file, copy below code in onCreate Java file:

ImageView imgVS = findViewById(R.id.imgVS);

DisplayMetrics metrics = getResources().getDisplayMetrics();
int width = metrics.widthPixels;

LinearLayout.LayoutParams map = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (width * 132 / 362));
imgVS.setLayoutParams(map);

GoodLuck!

Vahid Naghash
  • 525
  • 5
  • 11