Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Using TextView.SetWidth() With Values From Paint.MeasureText & Paint.GetTextBounds

$
0
0

I have a TextView for which I want to determine the width to later use with SetWidth. I have tried using both the Paint.MeasureText & Paint.GetTextBounds methods to obtain a value to use in TextView's SetWidth method, but both return values that are way too small (although they are returning larger values for larger amounts of text). Does this have something to do with what unit is used? In my xml I specify android:textSize="24dp", but when I look at the TextView's TextSize property in code, it returns 63. Do I need to do some kind of conversion before using the MeasureText or GetTextBounds values in SetWidth?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>