简体   繁体   中英

TextView with autoSizeTextType uniform. Need to relative to some other view

学位

I tried to set a degree symbol textview on top of another temperature textview. I achieved it by using relative layout. Here i want to set temperature textview as autosize. But as per document auto size textview must not be wrap_content. Is there any way to achieve this?

  <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:orientation="horizontal"
                    android:padding="3dp">


                    <TextView
                        android:id="@+id/temp"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_centerInParent="true"
                        android:layout_gravity="center"
                        android:fontFamily="@font/custom_font"
                        android:gravity="center_horizontal|center"
                        android:text="72"
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="@color/primary_font_color"
                        android:textSize="125sp" />

                    <TextView
                        android:id="@+id/temp"
                        style="@style/wrap"
                        android:layout_alignTop="@+id/temp"
                        android:layout_marginLeft="-10dp"
                        android:layout_marginTop="13dp"
                        android:layout_toRightOf="@+id/temp"
                        android:fontFamily="@font/opensans_light"
                        android:gravity="top"
                        android:text="°"
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="@color/primary_font_color"
                        android:textSize="40dp" />

                </RelativeLayout>

I have used this library and it worked in my scenario intuit library for scaleable dp .

Sorry for adding this message here I am new here and don't have enough repo to comment otherwise I would have written it in comment section. Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM