I wanted to know how to increase the size of the table layout??I have placed the textviews and edittext in table rows that appear on the left side of the screen. I wanted to design similar to this
You can use android:minHeight="60px" or assign the width/height to fill_parent.
Related
I want the items of the first column to stretch their height depending on the total height of the other column in the row.
Now I have it:
And I want it to be like that:
Is this possible without hardcoding the height through calculations?
Use compose arrangement 'equal weight' according to this documentation link
Modifier.weight()
I am currently trying to make a view with four buttons that each take up one quarter of the screen. I know you can use android:layout_weight to set the weight so that the extra space on one axis is filled up, but is there a way to set it so that the height and width are evenly distributed among the four buttons using layout_weight? If not, what is the correct way to do this?
use table layout and create two rows for 4 buttons,determined the height and width
all of these codes are ( XML code)..
should that will working
I have 2 textviews per horizontal linearlayout row on two rows. All the views are set as 0dp width and weight 1. They all have the same font and text size etc.
The views on the left side are gravity aligned left and the two on the right are gravity aligned right.
When both textviews text length overflow android always gives precedence to the textview on the right and ellipse the views on the left.
Is there a method that can be used to control which view ellipses when both views on the same row would not fit.
Ideally I want the views on the right to ellipse in favor of those on the left. Or failing that make them ellipse evenly per row.
thanks
i don't think there is a feature of order of the views to manage how they are measured.
you can customize the linearLayout by extending it in order to support this feature , but this is too hardcore for this task .
i would suggest putting the problematic views (those that take too much space and you don't with them to take too much space) into a new layout , and set its width to match_parent .
this way , it should take the rest of the space at the end of the measurements of the other views ,
I have a few buttons I want to display in a row in a decision tree. I'm trying to get the buttons in each row of the tree to be the same size. But the buttons have different text. Some have a couple words and some have a sentence. Is there a way I can get the buttons to all be the same size and all maintain the same width to height (4:3) ratio?
I can get the heights the same using fill parent on the button heights while having the parent row layout_height set to wrap_content. How can I get the width of the buttons to be the same size while maintaining a 4:3 width to height ratio. (The width to height ratio constraint is so I don't end up with really tall and thin buttons, which would look silly)
Anyone have any suggestions?
Edit:
I just saw this link which is kinda what I am looking for: Scaling layout with invariant aspect ratio in Android
My problem with this is that it will inflate all the buttons and introduce a lot of empty space around the text inside.
If I could find a way to incrementally increase the width or height (whichever is smaller) of the button and then resize it so it re-"wraps_content", then this could work. Anyone know how to re-wrap the content?
If you are able to get the same height for all you can use android:layout_weight="1" for all buttons and put android:layout_width="0dip" so all buttons will have same width
I am having a hard time understanding how to change the width of columns when creating a table view.
I know you can set the width in pixels of a column but that is not what I want to do.
Say, for instance, I have 2 columns and want each column to take up half the screen. How do I do this without explicitly setting the pixels, so that my code can work on multiple screen sizes?
With a TableLayout? You can't do that easily. The closest you can get is to use android:stretchColumns="*" on your TableLayout element. That should allocate any extra whitespace evenly between the two columns.
Just set the TableRow layout_width="0dip"
and then set the two column layout_weight="1"
This will help you evenly divide a row.