3

I want to build a screen like the following :

enter image description here

I want to build the book self like the picture . I thought a lot to build a gui like this and made the following decision to implement the screen . My observation tells me:

 1. This layout can not be designed using xml layout file . Rather its gui must be designed pragmatically . 
 2. Every row is a simple table row whose background color is wood color . In each table row there are two image view . The image of books will be put in to this image . 
 3. If a new book is inserted into database the list will be expanded . If no space in table row is available then a new table row will be created and the image of that book will be kept there . 

Is there any way to implement the whole GUI in layout xml file ? Is there any error in my concept to design the layout ? Whats other idea to design this layout file ?

osimer pothe
  • 2,827
  • 14
  • 54
  • 92

3 Answers3

2

Please see GridView guide. It does exactly what you want. You should just populate it with items and grid view will workout itself where to place it.

There can be problem with background, but you can set single item of a grid something like this:

Layout with "wood" background and two image views "shelf" at the bottom and "book" just above it.

This way is much better if you want to support landscape orientation and tablets.

Jin35
  • 8,602
  • 3
  • 32
  • 52
  • Thanks . Can you please write a little bit more about it ? I can not get a picture how grid view can solve my problem ? – osimer pothe Oct 12 '12 at 05:44
  • Read gread view guide please, it's quite good description of grid view and how it's works: http://developer.android.com/guide/topics/ui/layout/gridview.html – Jin35 Oct 12 '12 at 05:45
0

Personally to me, I could picture the original layout as linear, orientation vertical, and inside that linear layout is 3 more linear layouts, with orientation horizontal. Simply adjust the layout_weight to 3, 2, and 1 respectively, and each individual linear layouts having a layout_width of 0px. then its basically getting a picture in the background you can work off of.

Alternatively, you could make each shelf full of image views, that are invisible and as people add books, make them visible, and simply use the android:setx, and sety properties to align them. Its not very precise though, because it would look different on phones with bigger screens. So I'm going to have to say no its not possible to do purely in the xml file.

dannyRods
  • 552
  • 6
  • 23
  • Ok . If it is not possible to do it purely in xml file then can you tell me which part can be implemented in xml file ?? – osimer pothe Oct 12 '12 at 05:36
0

Useful articles that can help you in completing your task :

#1 You can refer an Shelves app. open source project available on google code. http://code.google.com/p/shelves/. This can help you.

#2 A post on SO.

#3 A post from CodeProject.

Community
  • 1
  • 1
Kartik Domadiya
  • 29,868
  • 19
  • 93
  • 104