Workaround to display AutoSizing text as wrap_content truncate contentHow to `wrap_content` while autosizing an Android TextView?Autosizing relative to content view, not superview?Autosizing text in TextView on Androidflex 4 autosize textHow do I play an audio file in Android?autosize text in EditText and TextView androidAutosizing row to its content in WebixLinearLayout Weights not working inside ListviewHow to `wrap_content` while autosizing an Android TextView?TextViewCompat does not works during autosizing of text view (for support library)Autosizing TextViews in RecyclerView causes text size to decrease

How to not confuse readers with simultaneous events?

How to draw a winding on a toroid of a circular cross section?

Is it legal for a supermarket to refuse to sell an adult beer if an adult with them doesn’t have their ID?

When can a polynomial be written as a polynomial function of another polynomial?

Is surviving this (blood loss) scenario possible?

Word for something indicating the importance of guarding it properly

Why a binary file is not shown as 0 and 1?

Operation Unzalgo

What is the period of Langton's ant on a torus?

Is this Android phone Android 9.0 or Android 6.0?

Which GPUs to get for Mathematical Optimization (if any)?

Necroskitter and creatures dying because of placing -1/-1 counters

Do dragons smell of lilacs?

Whipping heavy cream with melted chocolate

Column deletion based on number of string matches within column

Who determines when road center lines are solid or dashed?

Strategy to pay off revolving debt while building reserve savings fund?

Why teach C using scanf without talking about command line arguments?

What was the difference between a Games Console and a Home Computer?

Grouping into more groups in one iteration

Is straight-up writing someone's opinions telling?

How do you send money when you're not sure it's not a scam?

Is it possible to have two words with the same particle in a sentence?

Company looks for long-term employees, but I know I won't be interested in staying long



Workaround to display AutoSizing text as wrap_content truncate content


How to `wrap_content` while autosizing an Android TextView?Autosizing relative to content view, not superview?Autosizing text in TextView on Androidflex 4 autosize textHow do I play an audio file in Android?autosize text in EditText and TextView androidAutosizing row to its content in WebixLinearLayout Weights not working inside ListviewHow to `wrap_content` while autosizing an Android TextView?TextViewCompat does not works during autosizing of text view (for support library)Autosizing TextViews in RecyclerView causes text size to decrease






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to display a number as big as possible in one line with a suffix, I need autosizing.



I know wrap_content not available with autosize TextView, I found a workaround that works but not everytimes.
The value is truncated at the first display (It should display the value below : 1553593328254) :



enter image description here



In layout.xml



<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#cccccc"
android:layout_height="100dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_above="@+id/label"
android:layout_alignParentTop="true"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/value"
style="@style/BigValue"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start|bottom"
android:text="123456789"/>
<TextView
android:id="@+id/unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textSize="15sp"
android:text="%" />
</LinearLayout>
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Label" />
</RelativeLayout>


In styles.xml



<style name="BigValue">
<item name="android:maxLines">1</item>
<item name="autoSizePresetSizes">@array/big_value_autosize</item>
<item name="autoSizeTextType">uniform</item>
<item name="android:includeFontPadding">false</item>
<item name="android:lines">1</item>
</style>


In dimens.xml



<array name="big_value_autosize">
<item>40sp</item>
<item>50sp</item>
</array>


My test code in activity (Kotlin)



value.setOnClickListener 
val time = Date().time.toString()
value.text = time
label.text = time



I tried this solution, without success.










share|improve this question






























    0















    I want to display a number as big as possible in one line with a suffix, I need autosizing.



    I know wrap_content not available with autosize TextView, I found a workaround that works but not everytimes.
    The value is truncated at the first display (It should display the value below : 1553593328254) :



    enter image description here



    In layout.xml



    <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:background="#cccccc"
    android:layout_height="100dp">
    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_above="@+id/label"
    android:layout_alignParentTop="true"
    android:orientation="horizontal">
    <androidx.appcompat.widget.AppCompatTextView
    android:id="@+id/value"
    style="@style/BigValue"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:gravity="start|bottom"
    android:text="123456789"/>
    <TextView
    android:id="@+id/unit"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="8dp"
    android:textSize="15sp"
    android:text="%" />
    </LinearLayout>
    <TextView
    android:id="@+id/label"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="Label" />
    </RelativeLayout>


    In styles.xml



    <style name="BigValue">
    <item name="android:maxLines">1</item>
    <item name="autoSizePresetSizes">@array/big_value_autosize</item>
    <item name="autoSizeTextType">uniform</item>
    <item name="android:includeFontPadding">false</item>
    <item name="android:lines">1</item>
    </style>


    In dimens.xml



    <array name="big_value_autosize">
    <item>40sp</item>
    <item>50sp</item>
    </array>


    My test code in activity (Kotlin)



    value.setOnClickListener 
    val time = Date().time.toString()
    value.text = time
    label.text = time



    I tried this solution, without success.










    share|improve this question


























      0












      0








      0








      I want to display a number as big as possible in one line with a suffix, I need autosizing.



      I know wrap_content not available with autosize TextView, I found a workaround that works but not everytimes.
      The value is truncated at the first display (It should display the value below : 1553593328254) :



      enter image description here



      In layout.xml



      <RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:background="#cccccc"
      android:layout_height="100dp">
      <LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="0dp"
      android:layout_above="@+id/label"
      android:layout_alignParentTop="true"
      android:orientation="horizontal">
      <androidx.appcompat.widget.AppCompatTextView
      android:id="@+id/value"
      style="@style/BigValue"
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:gravity="start|bottom"
      android:text="123456789"/>
      <TextView
      android:id="@+id/unit"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="8dp"
      android:textSize="15sp"
      android:text="%" />
      </LinearLayout>
      <TextView
      android:id="@+id/label"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:text="Label" />
      </RelativeLayout>


      In styles.xml



      <style name="BigValue">
      <item name="android:maxLines">1</item>
      <item name="autoSizePresetSizes">@array/big_value_autosize</item>
      <item name="autoSizeTextType">uniform</item>
      <item name="android:includeFontPadding">false</item>
      <item name="android:lines">1</item>
      </style>


      In dimens.xml



      <array name="big_value_autosize">
      <item>40sp</item>
      <item>50sp</item>
      </array>


      My test code in activity (Kotlin)



      value.setOnClickListener 
      val time = Date().time.toString()
      value.text = time
      label.text = time



      I tried this solution, without success.










      share|improve this question
















      I want to display a number as big as possible in one line with a suffix, I need autosizing.



      I know wrap_content not available with autosize TextView, I found a workaround that works but not everytimes.
      The value is truncated at the first display (It should display the value below : 1553593328254) :



      enter image description here



      In layout.xml



      <RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:background="#cccccc"
      android:layout_height="100dp">
      <LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="0dp"
      android:layout_above="@+id/label"
      android:layout_alignParentTop="true"
      android:orientation="horizontal">
      <androidx.appcompat.widget.AppCompatTextView
      android:id="@+id/value"
      style="@style/BigValue"
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:gravity="start|bottom"
      android:text="123456789"/>
      <TextView
      android:id="@+id/unit"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="8dp"
      android:textSize="15sp"
      android:text="%" />
      </LinearLayout>
      <TextView
      android:id="@+id/label"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:text="Label" />
      </RelativeLayout>


      In styles.xml



      <style name="BigValue">
      <item name="android:maxLines">1</item>
      <item name="autoSizePresetSizes">@array/big_value_autosize</item>
      <item name="autoSizeTextType">uniform</item>
      <item name="android:includeFontPadding">false</item>
      <item name="android:lines">1</item>
      </style>


      In dimens.xml



      <array name="big_value_autosize">
      <item>40sp</item>
      <item>50sp</item>
      </array>


      My test code in activity (Kotlin)



      value.setOnClickListener 
      val time = Date().time.toString()
      value.text = time
      label.text = time



      I tried this solution, without success.







      android textview autosize android-textview-autosize






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 9:53







      A. Ferrand

















      asked Mar 26 at 9:46









      A. FerrandA. Ferrand

      4165 silver badges16 bronze badges




      4165 silver badges16 bronze badges






















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55354037%2fworkaround-to-display-autosizing-text-as-wrap-content-truncate-content%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55354037%2fworkaround-to-display-autosizing-text-as-wrap-content-truncate-content%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript