• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Layout aligning problem

 
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have problem with layout which i cannot align elements where i really want to.

There is a small picture of layout design which i want to create but i came up with mess.
So, what i want is force listview use only blank area (shown as white) and OK/Cancel buttons are (ALWAYS) keep bottom.

I fixed this issue by hard coding about height and as you may guess my layout mess up with different size of Screen resolution.
My current layout is :

LinearLayout (Vertical)
|_ FrameLayout (Holds App title)
|_ LinearLayout (Horizontal)
|_ ListView
|_ FrameLayout (Holds buttons)

When user type something into textbox and hit OK button i want to show it in Listview and if there are too many items in it
then start scroll but ONLY listview.

App Title, Textbox and Buttons MUST stay same position.

I really appreciate for any help/idea.

Regards
Untitled.jpg
[Thumbnail for Untitled.jpg]
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will give you the same advice I gave you last time you asked this question: use a relative layout:
RelativeLayout
|-- App Title (aligned to parent top, aligned to parent left, aligned to parent right)
|-- Text Box (below Title, aligned parent left, aligned parent right)
|-- OK buttun (aligned to parent bottom, aligned to parent start)
|-- Cancel button (aligned to parent bottom, aligned to parent end)
|-- ListView (below TextBox, above OK button, aligned parent left, aligned parent right

The app title is forced to the top of the screen. The Text box is forced underneath it. The buttons are placed at the bottom of the screen, and the list fills the space in between.

You might want to reverse the OK and Cancel buttons - put the OK on the right / end and the Cancel on the left / start. This is an Android OS convention that makes your app fit better with user expectations.
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Below are screenshots of a layout as described above.
Big-Layout.png
[Thumbnail for Big-Layout.png]
Layout using RelativeLayout on a 4.5 in display
Small-Layout.png
[Thumbnail for Small-Layout.png]
Layout using RelativeLayout on a 3.2 in display
 
ibrahim yener
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Steve

I don't know who you are. I will look for you. I will find you and I will buy a beer for you.

I tried relative layout couple of times before but i didn't know Start and Stop points of elements.
So, i have assigned unique ID each layout and now it works like charm.

Thanks for your help.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic