0

That's how I want it to be

That's the snippet for the avatar image part:

<FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal">

                <com.test.testtwo.customview.CustomFontView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text="@string/str_edit"
                    android:id="@+id/txtEditAvatar"
                    android:drawablePadding="5dp"
                    android:drawableLeft="@mipmap/icon_edit"
                    android:layout_marginLeft="5dp"
                    android:layout_gravity="bottom|right" />

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center_horizontal|top">

                    <com.test.testtwwo.customview.RoundedImageView
                        android:layout_width="100dp"
                        android:layout_height="100dp"
                        android:id="@+id/imgAvatar"
                        android:src="@mipmap/placeholder_user"
                        app:oval="true"
                        app:border_color="@color/white"
                        app:border_width="2dp"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginLeft="30dp"
                        android:layout_marginRight="30dp"
                        android:scaleType="centerCrop"/>
                </RelativeLayout>

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:background="@color/action_button_text">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:text="Alterar"
                        android:id="@+id/tvAlterar"
                        android:layout_gravity="bottom|center_horizontal"
                        android:gravity="bottom"
                        android:layout_marginBottom="8dp" />
                </LinearLayout>

            </FrameLayout>

And that's howw it looks now: I have to "fit this linear layout inside that round ImageView, but I don't know how " Image here

Thanks in advance.

  • I'd recommend playing with a custom view, to 1.draw the bitmap 2. create a rounded path 3. clip the canvas to the path 4. Draw the rectangle, which will be clipped to the path. To give you a starting point, you can have a look at my previous answer here where you get part of the logic : http://stackoverflow.com/a/36764393/4706693 – NSimon Jun 03 '16 at 11:39
  • I saw that post, but still don't get how to fit that shape in an ImageView like mine ): – Daniel Gomes Jun 03 '16 at 17:40

0 Answers0