I want to impose for example, I remember how it turned out you can help. There is a code you need to put an avatar element on a circle (so that it is on top of it)

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_item" android:layout_width="match_parent" android:layout_height="72dp" android:foreground="?android:attr/selectableItemBackground" android:gravity="center_vertical" android:background="@drawable/start_click" android:orientation="horizontal"> <ImageView android:id="@+id/avatar" android:layout_width="@dimen/list_item_avatar_size" android:layout_height="@dimen/list_item_avatar_size" android:layout_marginRight="16dp"/> <ImageView android:id="@+id/circle" android:layout_width="@dimen/list_item_avatar_size" android:layout_height="@dimen/list_item_avatar_size" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:layout_marginStart="16dp" android:gravity="center_vertical" android:orientation="vertical"> <TextView android:id="@+id/list_item_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/primary_text_default_material_light" android:textSize="16sp" /> <TextView android:id="@+id/Tag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="tag, import" android:textColor="@color/primary" android:layout_gravity="right" android:layout_marginTop="5dp" android:textSize="10sp" /> </LinearLayout> </LinearLayout> 

    2 answers 2

    To set widgets, the FrameLayout container is FrameLayout , which places all widgets from the upper left corner, if gravity is not specified (or RelativeLayout , if positioning is more complicated)

     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_item" android:layout_width="match_parent" android:layout_height="72dp" android:foreground="?android:attr/selectableItemBackground" android:gravity="center_vertical" android:background="@drawable/start_click" android:orientation="horizontal"> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:id="@+id/avatar" android:layout_width="@dimen/list_item_avatar_size" android:layout_height="@dimen/list_item_avatar_size" android:layout_marginRight="16dp"/> <ImageView android:id="@+id/circle" android:layout_width="@dimen/list_item_avatar_size" android:layout_height="@dimen/list_item_avatar_size" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:layout_marginStart="16dp" android:gravity="center_vertical" android:orientation="vertical"> <TextView android:id="@+id/list_item_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/primary_text_default_material_light" android:textSize="16sp" /> <TextView android:id="@+id/Tag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="tag, import" android:textColor="@color/primary" android:layout_gravity="right" android:layout_marginTop="5dp" android:textSize="10sp" /> </LinearLayout> </LinearLayout> 

    For simple cases, you can use the solution from this answer.

    • you are always the first! :) - Flippy

    FrameLayout is a container for displaying one View on top of another. Approximate code such, understand yourself.

     <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/circle" android:layout_width="@dimen/list_item_avatar_size" android:layout_height="@dimen/list_item_avatar_size" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" />