Force Activity to resize to device screen

latcc

Banned
Is there any way to force the Activity to take the size of the device?

We can detect the screen size but how can we use this to fill the screen for those less than standard screen sizes? It would be preferable to cover the full area of the screen with the activity, even if we can't or don't move all the views to fit it asthetically.

I see the activity as a primary 'panel' which is set to the layout size chosen by Android. Is it at all possible to change this in code??
 

klaus

Expert
Licensed User
Longtime User
This sounds strange to me.
What kind of Activity are you speaking of?
Activities take 100% of the devices screen.
Activity.Width = 100%x
Activity.Height = 100%y

But if you have a Panel added in the Designer and your device has another width/height ratio than the layout variant, the Panel will not be adjusted nor will be the other views.

Best regards.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Activities ALWAYS assume the device's width and height and therefore are ALWAYS 100% of its values...
The within Views can be one of these:
Auto resisable using either dip or % values
sizes in the designer for a particular screen layout
Fixed sized using absolute pixel values.

If you VIEWS position seems wrong then you need to check how you are sizing them..NOT the activity
 
Upvote 0

latcc

Banned
"Activities ALWAYS assume the device's width and height and therefore are ALWAYS 100% of its values"

That is wrong. I have seen a B4A program I wrote take a smaller size than the tablet it was displayed on. It did not fill the entire screen but took up a rectangle area of about 70% of the screen leaving the 'home' screen showing in the other 30% of the screen at the very same time. I have been searching thru emails to try to find the image of this to prove this does happen. This is why I asked about how to stretch the activity background to 100% of the screen. It doesn't always happen automatically. If you guys are interested, or don't believe this happens, I will make a harder attempt to find this screen image showing this 'not 100%' activity display.

Anyway I will try the code in this thread and see if it does the job.
 
Upvote 0

latcc

Banned
Hi.

Take a look at this recent thread: http://www.b4x.com/forum/basic4andr...02-how-create-special-activity.html#post77434.

Maybe that's the effect you've see?

Martin.
Here is a poor example of what I mean. I can't find the really clear screen shot I was emailed.

This is a grey tab view sized to 100% of the activity. Note the activity doesn't take up the whole screen. On the upper right you can see parts of another application or maybe it is the Android system. So the Activity doesn't always fill 100% of the screen. And this problem seems to happen on tablets much more than phones.

FWIW. in this test program the biggest layout was 480x800@160dpi and the device screen was 600x1024 @160dpi.
 

Attachments

  • 20111203223410.jpeg
    8.3 KB · Views: 497
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…