[android-developers] Re: A table-type layout with the contents centered inside

2009-10-29 Thread Miguel Paraz

On Oct 22, 8:05 pm, Mark Murphy mmur...@commonsware.com wrote:
 MiguelParazwrote:
  Hi,
  I would like a table-style layout where the cell sizes are
  automatically computed, without using AbsoluteLayout to position
  them.

  For example, the table has width 320 and height 240. For a 4x4 cell
  table, each cell is of width 80 and height 60.

  Inside each cell, I'd like the images centered inside. For example, if
  the image is of width 40 and height 30, they will be positioned at
  (20, 15) inside each cell.

  I can't see how TableLayout supports - does it?

 Not the automatically computed part. There is no layout that achieves
 your desired effect and does the automatically computed part.GridView
 does the automatically computed work, but it is not a layout, but a
 selection widget (extends AdapterView).


Hi Mark,
GridView plus using ImageView.ScaleType.CENTER does achieve the effect
I want.
The drawback is that I need to set the ImageViews and their intents in
code.
It's no big deal for now, but going forward I'd like to make this into
a Layout so I can do the layout in XML.

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: A table-type layout with the contents centered inside

2009-10-22 Thread Mark Murphy

Miguel Paraz wrote:
 Hi,
 I would like a table-style layout where the cell sizes are
 automatically computed, without using AbsoluteLayout to position
 them.
 
 For example, the table has width 320 and height 240. For a 4x4 cell
 table, each cell is of width 80 and height 60.
 
 Inside each cell, I'd like the images centered inside. For example, if
 the image is of width 40 and height 30, they will be positioned at
 (20, 15) inside each cell.
 
 I can't see how TableLayout supports - does it?

Not the automatically computed part. There is no layout that achieves
your desired effect and does the automatically computed part. GridView
does the automatically computed work, but it is not a layout, but a
selection widget (extends AdapterView).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in Germany, 18-22 January 2010: http://bignerdranch.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: A table-type layout with the contents centered inside

2009-10-22 Thread Miguel Paraz

On Oct 22, 8:05 pm, Mark Murphy mmur...@commonsware.com wrote:
 Miguel Paraz wrote:
  Hi,
  I would like a table-style layout where the cell sizes are
  automatically computed, without using AbsoluteLayout to position
  them.

  For example, the table has width 320 and height 240. For a 4x4 cell
  table, each cell is of width 80 and height 60.

  Inside each cell, I'd like the images centered inside. For example, if
  the image is of width 40 and height 30, they will be positioned at
  (20, 15) inside each cell.

  I can't see how TableLayout supports - does it?

 Not the automatically computed part. There is no layout that achieves
 your desired effect and does the automatically computed part. GridView
 does the automatically computed work, but it is not a layout, but a
 selection widget (extends AdapterView).


Thanks for the confirmation, Mark. Maybe it's time for me to learn how
to build custom layouts. For now I could use AbsoluteLayout but it's
not going to scale.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---