ilan Expert Licensed User Longtime User Dec 13, 2015 #1 Hi, after 3 years and (about 50 apps) i will ask this silly question . i am making a new app and i would like to be able to use it in portrait and landscape. i want to put the views a little bit different when i use it in landscape mode not like it is in portrait since i have more place in the x axis. so i created 2 different variants 1920*1080 & 1080*1920 this is the phone i am using (galaxy s5) the question is do i need to set all available variants or it is enough to set 2 variants 1 for portrait and 1 for landscape? i define the views position and size in script variant and not in general variant. is this correct? another question if i add new views programmatically can i say if landscape then do this else do this...? if yes how? thanx, ilan
Hi, after 3 years and (about 50 apps) i will ask this silly question . i am making a new app and i would like to be able to use it in portrait and landscape. i want to put the views a little bit different when i use it in landscape mode not like it is in portrait since i have more place in the x axis. so i created 2 different variants 1920*1080 & 1080*1920 this is the phone i am using (galaxy s5) the question is do i need to set all available variants or it is enough to set 2 variants 1 for portrait and 1 for landscape? i define the views position and size in script variant and not in general variant. is this correct? another question if i add new views programmatically can i say if landscape then do this else do this...? if yes how? thanx, ilan
LucaMs Expert Licensed User Longtime User Dec 13, 2015 #2 ilan said: or it is enough to set 2 variants 1 for portrait and 1 for landscape? Click to expand... I think yes. ilan said: i define the views position and size in script variant and not in general variant. is this correct? Click to expand... YES! ilan said: if i add new views programmatically can i say if landscape Click to expand... You should test the orientation: [Globals] Private Landscape As Boolean Activity_Create Landscape = (100%x > 100%y) If Landscape Then ' resize/move new views Else ' resize/move new views End If Upvote 0
ilan said: or it is enough to set 2 variants 1 for portrait and 1 for landscape? Click to expand... I think yes. ilan said: i define the views position and size in script variant and not in general variant. is this correct? Click to expand... YES! ilan said: if i add new views programmatically can i say if landscape Click to expand... You should test the orientation: [Globals] Private Landscape As Boolean Activity_Create Landscape = (100%x > 100%y) If Landscape Then ' resize/move new views Else ' resize/move new views End If
ilan Expert Licensed User Longtime User Dec 13, 2015 #3 LucaMs said: You should test the orientation: [Globals] Private Landscape As Boolean Activity_Create Landscape = (100%x > 100%y) If Landscape Then ' resize/move new views Else ' resize/move new views End If Click to expand... smart!! Upvote 0
LucaMs said: You should test the orientation: [Globals] Private Landscape As Boolean Activity_Create Landscape = (100%x > 100%y) If Landscape Then ' resize/move new views Else ' resize/move new views End If Click to expand... smart!!
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2015 #5 ilan said: so i created 2 different variants 1920*1080 & 1080*1920 Click to expand... Note that these numbers without the scale are meaningless. Make sure to use a "normalized variant" (an equivalent variant with a scale of 1.0). Upvote 0
ilan said: so i created 2 different variants 1920*1080 & 1080*1920 Click to expand... Note that these numbers without the scale are meaningless. Make sure to use a "normalized variant" (an equivalent variant with a scale of 1.0).
ilan Expert Licensed User Longtime User Dec 14, 2015 #6 Erel said: Note that these numbers without the scale are meaningless. Make sure to use a "normalized variant" (an equivalent variant with a scale of 1.0). Click to expand... sorry but i dont understand you, i always used on my apps only 1 variant portrait or landscape now i would like to use both but views should not be in the same location when i rotate my phone so what i do i create 2 script variant with resolution 1920*1080 & 1080*1920 scale 3.0! but i disable 'Autoscaleall and every view i set his position and size with % like view1.left = 0 view1.height = 5%y ... so no need for autoscaleall but what i would like to know is if i set 2 variants 1 for portrait and 1 for landscape will all devices that are in landscape mode get the variant i set with 1920*1080? or could they get the portrait variant and views would not be like i wanted them to be?? because that device has a different resolution that is not defined. could you please explain a little bit more? thank you for your patience @Erel Upvote 0
Erel said: Note that these numbers without the scale are meaningless. Make sure to use a "normalized variant" (an equivalent variant with a scale of 1.0). Click to expand... sorry but i dont understand you, i always used on my apps only 1 variant portrait or landscape now i would like to use both but views should not be in the same location when i rotate my phone so what i do i create 2 script variant with resolution 1920*1080 & 1080*1920 scale 3.0! but i disable 'Autoscaleall and every view i set his position and size with % like view1.left = 0 view1.height = 5%y ... so no need for autoscaleall but what i would like to know is if i set 2 variants 1 for portrait and 1 for landscape will all devices that are in landscape mode get the variant i set with 1920*1080? or could they get the portrait variant and views would not be like i wanted them to be?? because that device has a different resolution that is not defined. could you please explain a little bit more? thank you for your patience @Erel
LucaMs Expert Licensed User Longtime User Dec 14, 2015 #7 Erel said: Note that these numbers without the scale are meaningless. Make sure to use a "normalized variant" (an equivalent variant with a scale of 1.0). Click to expand... ilan said: sorry but i dont understand you Click to expand... New variant: 1920x1080 scale 3 press YES (Sì) Upvote 0
Erel said: Note that these numbers without the scale are meaningless. Make sure to use a "normalized variant" (an equivalent variant with a scale of 1.0). Click to expand... ilan said: sorry but i dont understand you Click to expand... New variant: 1920x1080 scale 3 press YES (Sì)
LucaMs Expert Licensed User Longtime User Dec 14, 2015 #8 do some tests (and F6 - "Send to UI Cloud") Upvote 0
ilan Expert Licensed User Longtime User Dec 14, 2015 #9 thanx a lot, it is much easier then i thought. i am very impressed, i just need to find a way how to store my data in activity_pause because the rotation restart the activity. thanx a lot @LucaMs Upvote 0
thanx a lot, it is much easier then i thought. i am very impressed, i just need to find a way how to store my data in activity_pause because the rotation restart the activity. thanx a lot @LucaMs
LucaMs Expert Licensed User Longtime User Dec 14, 2015 #10 ilan said: i just need to find a way how to store my data in activity_pause because the rotation restart the activity. Click to expand... https://www.b4x.com/android/forum/t...android-applications-settings-and-state.9777/ ilan said: thanx a lot @LucaMs Click to expand... Prego (you're welcome ) Upvote 0
ilan said: i just need to find a way how to store my data in activity_pause because the rotation restart the activity. Click to expand... https://www.b4x.com/android/forum/t...android-applications-settings-and-state.9777/ ilan said: thanx a lot @LucaMs Click to expand... Prego (you're welcome )