AAA
AAA

Reputation: 505

How to add a line accross layout like in the given image?

I want to make my layout below like in the image I have added at the end. I am able to rotate and add a picture as in the image, but the problem is that the line is going out of the border.

So, how can I perfectly make that lie within border?

<RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:background="@drawable/cover_pic_background"
                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:background="#736f6f"
                    >

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/star"
                        />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Certified"
                        android:layout_gravity="center"
                        android:textSize="30sp"

                        />

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/star"

                        />

                </LinearLayout>

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/imageViewId_CoverPic"
                    android:scaleType="centerInside"
                    android:padding="3dp"
                    />

                <ImageView
                    android:id="@+id/inside_imageview"
                    android:layout_width="80dp"
                    android:layout_height="90dp"
                    android:layout_marginStart="39dp"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentStart="true"
                    android:scaleType="centerInside"
                    android:background="@drawable/cover_pic_background"
                    android:elevation="5dp"
                    />

            </RelativeLayout>

Upvotes: 0

Views: 71

Answers (2)

Dhruv Patel
Dhruv Patel

Reputation: 1529

Make transparent image with this design. And put it over profile pic.

enter image description here

Upvotes: -1

Goku
Goku

Reputation: 9692

Try this

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="250dp"
    android:layout_margin="10dp">

    <ImageView
        android:id="@+id/nilu"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:src="@color/colorAccent" />

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="250dp"
        android:layout_height="150dp"

        android:layout_alignBottom="@+id/nilu"
        android:layout_alignParentStart="true"
        android:src="@mipmap/ic_launcher_round" />


    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/imageView"
        android:layout_alignTop="@+id/imageView"
        android:layout_marginLeft="-70dp"
        android:background="@color/colorPrimary"
        android:padding="10dp"
        android:paddingStart="50dp"
        android:rotation="-50"
        android:layout_marginTop="-10dp"
        android:text="certified profile"
        android:textColor="#ffffff" />

</RelativeLayout>

OUTPUT enter image description here

Upvotes: 4

Related Questions