How to ellipsize views in a viewgroup

view story

http://stackoverflow.com – Lets say I have a RelativeLayout or any such ViewGroup and add Views to it such that they get ellipsized in the viewgroup. Consider the dotted lines as a ViewGroup and the buttons are added to it when I click on them. In 1st case there are 4 buttons in line-1 and in 2nd case there are 6 buttons depending on the space they take. To be specific: In my application I have 5 buttons which are to be displayed this way, though the buttons text is know and the width will be wrap_content what I am concerned about is the screen size. I want all the 5 buttons to go in as min lines as possible, with (HowTos)