Created
September 24, 2017 20:55
-
-
Save dharmakshetri/e83d6f0e371e6579e4eb7c070e248341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
// Autosizing from programmatically | |
//configure uniform autosize | |
textview.setAutoSizeTextTypeWithDefaults(TextView.AUTO_SIZE_TEXT_TYPE_UNIFORM) | |
// via support library | |
TextViewCompat.setAutoSizeTextTypeWithDefaults(textview,TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM) | |
//set properties of textview | |
textview.setAutoSizeTextTypeUniformWithConfiguration(12,100,2,2) | |
// via support library | |
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(textview,12,100,2,2) | |
//set preset sizes | |
val presetSize:IntArray = intArrayOf(10,12,30,40,100) | |
textview.setAutoSizeTextTypeUniformWithPresetSizes(presetSize,2) | |
// via support library | |
TextViewCompat.setAutoSizeTextTypeUniformWithPresetSizes(textview,presetSize,2) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment