This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

How to fit two Button views in single cell in Android's GridLayout?

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this super complicated design in the attachment. I would like to fit left and right parenthesis in single cell (row 1, col 1) so they occupy 1/2 of the cell for each button. I have following xml

Calc-design.png
[Thumbnail for Calc-design.png]
 
Saloon Keeper
Posts: 6211
157
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You couLd use a TableLayout (or some other layout like LinearLayout) inside of that grid cell.
 
Mike Gosling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried with that one as well. No way to get it nearly as I want.

 
Tim Moores
Saloon Keeper
Posts: 6211
157
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried with that one as well. No way to get it nearly as I want.


What does that mean, exactly? What was the result, and how did that differ from what you wanted?
 
Mike Gosling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that that ( and ) keep using too much space and eventually the / sign gets pushed out from the screen. I don't know how to make ( and ) take 1/2 of their original width, so I could accommodate their width in cell.

Turns out, according to some SO posts, that GridLayout is not meant for this kind of action. As Tim suggested, I also tried with Linear Layout. I'm getting similar results.



Again, as with TableLayout, both ( and ) takes too much of space. They in total should take as much now one button takes place. Division sign gets push out.

Should I try to do this design in LinearLayout (horizonatl) only?
Screenshot_2.png
[Thumbnail for Screenshot_2.png]
 
Mike Gosling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I give up on GridLayout. I actually used this guy's tutorila on Linear Layout. Super cool idea to nest linear layouts.

 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!