Android Question How to get view into dip format?

Levisvv

Member
Licensed User
Longtime User
I am moving images around a layout, and need the top/left locations to be in dip format, how can I accomplish this when my code is as follows:?
B4X:
v.Left=(((col-1)*80)+7)
v.Top=(((row-1)*96)+6)

I cannot just add "dip" to the end of each row that gives an error?
 

KMatle

Expert
Licensed User
Longtime User
Haters gonna hate... I like to add views on my own and I don't "like" to use dip. Why? Because there is a mix between absolute coordinates (with some%x and some%y) and relative "dip" (here I don't know how large the view really is - except I check the absolute coordinates - and then I'm back to x+y). Even when you use texts in a label/edittext. You always have to calculate the size.

Take a look here: http://www.b4x.com/android/forum/threads/supporting-multiple-screens-tips-and-best-practices.17647/
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…