1

I need to have a circle( like floating action button) with text in the center which doesn't scale horizontally. cause if it scales it becomes an oval. I used a circle like here but it turns into an oval on stretching. I'm trying to use a fab for it now but I don't know how to implement it. The text always flows away from the circle. My minimum API level is 21. This is the end result how I want it to be if you still did'nt get it then please comment.

  <FrameLayout
                        android:layout_width="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginEnd="8dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="bottom|right">

                        <com.google.android.material.floatingactionbutton.FloatingActionButton
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:elevation="0dp"
                            android:src="@android:color/transparent" />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:text=" 20 Left"
                            android:gravity="center"
                            android:elevation="16dp"
                            android:drawableTop="@drawable/ic_star_white"
                            android:textColor="@android:color/black"
                            android:textAppearance="?android:attr/textAppearanceMedium" />
                    </FrameLayout>
Ashutosh
  • 151
  • 12

0 Answers0