H Hubert Brandel Active Member Licensed User Longtime User Dec 2, 2011 #1 Hi, I use labels to display Values. But some users can click on it and start an editor windows. I just take the labels size and position and create a editView a little bit bigger, with this code it works fine on my Samsung Galaxy S and some other devices: Code: Sub EditFeldopen( nLeft As Int, nTop As Int, nWidth As Int ) Dim nHeight As Int : nHeight = 60 ... ' editview have margins nLeft = nLeft-5 nTop = nTop-5 nWidth = nWidth+10 'EditFeld.SetLayout( nLeft , nTop, nWidth, nHeight ) EditFeld.Left = nLeft EditFeld.Top = nTop EditFeld.Width = nWidth ' EditFeld.Height = nHeight ' defined in designer, will not change then I found a method to change the size with one line ... Code: Sub EditFeldopen( nLeft As Int, nTop As Int, nWidth As Int ) Dim nHeight As Int : nHeight = 60 ... ' editview have margins nLeft = nLeft-5 nTop = nTop-5 nWidth = nWidth+10 ' shorter ... EditFeld.SetLayout( nLeft , nTop, nWidth, nHeight ) It works on my Samsung, but on a X2 Tablet with the same size and dpi the editview was bigger than it should be ? Does this changes more than just the sizes ?
Hi, I use labels to display Values. But some users can click on it and start an editor windows. I just take the labels size and position and create a editView a little bit bigger, with this code it works fine on my Samsung Galaxy S and some other devices: Code: Sub EditFeldopen( nLeft As Int, nTop As Int, nWidth As Int ) Dim nHeight As Int : nHeight = 60 ... ' editview have margins nLeft = nLeft-5 nTop = nTop-5 nWidth = nWidth+10 'EditFeld.SetLayout( nLeft , nTop, nWidth, nHeight ) EditFeld.Left = nLeft EditFeld.Top = nTop EditFeld.Width = nWidth ' EditFeld.Height = nHeight ' defined in designer, will not change then I found a method to change the size with one line ... Code: Sub EditFeldopen( nLeft As Int, nTop As Int, nWidth As Int ) Dim nHeight As Int : nHeight = 60 ... ' editview have margins nLeft = nLeft-5 nTop = nTop-5 nWidth = nWidth+10 ' shorter ... EditFeld.SetLayout( nLeft , nTop, nWidth, nHeight ) It works on my Samsung, but on a X2 Tablet with the same size and dpi the editview was bigger than it should be ? Does this changes more than just the sizes ?
NJDude Expert Licensed User Longtime User Dec 2, 2011 #2 You should be using DIP, like this: Code: ... nHeight = 60dip ... nWidth = nWidth + 10dip Upvote 0
stevel05 Expert Licensed User Longtime User Dec 2, 2011 #3 You can change the padding (Margins) in the edit text using the reflection library if it helps with alignment: Code: Dim refl AS Reflector refl.Target=EditFeld refl.RunMethod4("setPadding", Array As Object(Left, Top, Right, Bottom), _ Array As String("java.lang.int", "java.lang.int", "java.lang.int","java.lang.int")) Where Left,Top,Right and Bottom are integer variables. Upvote 0
You can change the padding (Margins) in the edit text using the reflection library if it helps with alignment: Code: Dim refl AS Reflector refl.Target=EditFeld refl.RunMethod4("setPadding", Array As Object(Left, Top, Right, Bottom), _ Array As String("java.lang.int", "java.lang.int", "java.lang.int","java.lang.int")) Where Left,Top,Right and Bottom are integer variables.