Menu bar on bottom part of layout

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Menu bar on bottom part of layout

Postby mmdumi » Thu Sep 17, 2009 12:12 am

Hello,
My application has some buttons in the bottom part of activity layout, almost the same like iphone has on ipod app for example.
I would like to create my layout so that it will self adjust on different screen sizes.
For example if the content in my layout has height = 400dip and the menu bar in the bottom has height = 100 dip, on every screen size (240*320, 320*480 etc.) i would like the menu bar to stay at the bottom so :

- on screen size 240*320
-> 100dip - for menubar
-> 220dip - for content => it remains 180 dip to show, so this content area should be in some kind of a scrollview so that i can view 400dip in only 220dip.

I have tested different possibilities, with relativelayout so that the menu bar could stay on bottom, but i could not put the scroll view on top so that the scroll appears only on small screen sizes.

This is so sick, how do you build your layouts for different screen sizes ?
Thanks.
mmdumi
Freshman
Freshman
 
Posts: 9
Joined: Tue Aug 25, 2009 9:31 am
Location: Bucharest

Top

Postby cyberbandya » Thu Sep 17, 2009 8:30 am

Hi mmdumi,

There is a little bit hectic solution for your problem. but yes you can try it out.

You can try onMeasure() and onLayout() functions of the linear layout. What you can do is you can get the screen resolution from the code below in your activity.

WindowManager w = yourActivity.getWindowManager();
Display d = w.getDefaultDisplay();
screenHeight = d.getHeight();
screenWidth = d.getWidth();

Then you can create your own layout by extending any layout and in the onMeasure() function you can set your calculated width and height appropriate for your layout based on screen resolution by using setMeasuredDimensions() function. Then your layout will have this width and height.

So the layout containing your menu buttons will adjust its width and height based on screen resolution.
Regards,
cyberbandya ;)
cyberbandya
Freshman
Freshman
 
Posts: 3
Joined: Fri Aug 28, 2009 7:17 am

Reply

Postby mmdumi » Thu Sep 17, 2009 10:17 am

Hy cyberbandy, thanks for your reply.
Actually i read a couple of articles and lot's of things on different forums about this problem, and my conclusion was: you can / should not depend on getWidth, getHeight functions, because different phones (with qwerty keyboard or not) don't work the same.
I think that the layout shoud resive itself for different screen sizes, and by using scrollview i should imply the view that should stretch.

Don't you think the same ? Or could someone tell me how do you build your apps?
For now all android phones have 320*480 resolution, but the new htc tatto has 240*320, so will your apps work the same ?
mmdumi
Freshman
Freshman
 
Posts: 9
Joined: Tue Aug 25, 2009 9:31 am
Location: Bucharest

Postby qlimax » Sun Sep 20, 2009 10:45 pm

http://developer.android.com/sdk/androi ... ights.html

[youtube]http://www.youtube.com/watch?v=MBRFkLKRwFw&feature=player_embedded#t=16[/youtube]

Android 1.6 adds screen support that enables applications to be rendered properly on different display resolutions and densities. Developers can also specify the types of screens supported by their application.


HTC Tattoo will be Android 1.6


Bye :wink:
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby mmdumi » Sun Sep 20, 2009 11:04 pm

Ok, well ... the problem was solved here:
http://groups.google.com/group/android- ... c24ad923a8

I see that a lot of people arrive on this forum. I had 100 views on this thread but no person reply to it. I guess that you (plusminus - i saw that you are the owner of this forum) have to "invest" in people that will actualy respond to problems.
mmdumi
Freshman
Freshman
 
Posts: 9
Joined: Tue Aug 25, 2009 9:31 am
Location: Bucharest

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 6 guests