开发者

How to put images at exact location dynamically

开发者 https://www.devze.com 2023-02-17 02:20 出处:网络
I saw this somewhere and was wondering how to achieve this. suppose i have a shelf background and i have cover images of books. how can i put those images exactly on each wodden plates edges dynamic

I saw this somewhere and was wondering how to achieve this. suppose i have a shelf background

How to put images at exact location dynamically

and i have cover images of books. how can i put those images exactly on each wodden plates edges dynamically.Number of books are not fixed they might go beyond the capacity of shelf then shelf will also grow. Each level of shelf contains maximum 3 cover images of book.

ca开发者_运维知识库n i do this on background or do i need to draw a shelf on canvas or something else??


Once I tried this kind of UI , There might be several approach , My approach was ,

I had a list view with background as 3D shelf , not like the one which you have shown which has white color wall and other things. Background(3D shelf) which I used to fit entire screen , and space each row of list item exactly to the row of 3D shelf and in list items have 3 buttons with horizontal orientation.

There is already an app called Shelves , Check UI there , it is open source , code there might help you better

http://www.androidpolice.com/2010/08/19/app-of-the-week-shelvescatalogue-your-possessions/


You can achieve it. But you need to be very precise calculation for the width of shelf.

  1. take FrameLayout. Now In this FrameLayout
  2. take ImageView with this shelf image. Add it to FrameLayout
  3. In FrameLayout, take 4 LinearLayouts with horizontal orientation for 4 shelves and adjust its height and left margin exactly as per shelf
  4. add ImageViews of books in those LinearLayouts
0

精彩评论

暂无评论...
验证码 换一张
取 消