EDIT:
And As I Search on StackOverflow now I found This Question is Duplicate of : This and This
You need to use another function setTextSize(unit, size)
with unit SP
like this,
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18f);
Please read more for TypedValue constants.
More Related Contents:
- How can I showing checkbox when I choose the spinner data?
- how to insert a data into database using android studio and phpmyadmin(wampserver)?
- How to get the width and height of an android.widget.ImageView?
- How do I use disk caching in Picasso?
- How can I use speech recognition without the annoying dialog in android phones
- dynamically add and remove view to viewpager
- Datepicker: How to popup datepicker when click on edittext
- In eclipse, unable to reference an android library project in another android project
- Change the circle color of radio button
- gradle – library duplicates in dependencies
- How to pause/resume thread in Android?
- How to change the color of header bar and address bar in newest Chrome version on Lollipop?
- Kotlin: Whats does “return@” mean?
- What method should I use now since FirebaseInstanceId.getInstance().getToken() is deprecated [duplicate]
- How to get a non scrollable ListView?
- Android: how to draw a border to a LinearLayout
- How to use android canvas to draw a Rectangle with only topleft and topright corners round?
- SVG support on Android
- CheckBox gets unchecked on scroll in a custom listview
- How to fix “Fail to connect to camera service” exception in Android emulator
- Android test code coverage with JaCoCo Gradle plugin
- java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED on KitKat only
- Android: Save file permanently (even after clear data / uninstall)
- Need some clarification about beta/alpha testing on the developer console
- How disable / remove android activity label and label bar?
- Android — How to allow horizontal and vertical scrolling
- How to send GCM messages to multiple devices at a time
- Android Location listener in Service does not work until I reactivate WiFi/mobile network
- Onscroll selected checkbox getting unchecked using listiview
- How to combine two live data one after the other?