0

What I need to know

I need to know how can I change the height of any item (in this case it's a spinner).

What is my program composed of

My program is composed of a Table having table rows (which are added pragmatically).

What I want to achieve:

I want to make all items in every row of same height.

What the Program does:

Every time you press the add button a TextView , Spinner , EditText are added inside a row which is also generated.

Notes

P.S: If you know any other way (Not listed in "What I want to achieve") to achieve my goal just post it

Image

Community
  • 1
  • 1
SamJ
  • 413
  • 1
  • 4
  • 18

2 Answers2

1

My guess is that you can either change your spinner's size so that it doesn't look huge compared to the other elements (see How can I change/decrease the Android spinner size?) or change the alignment of your items (see Android View align bottom (programmatically) without XML), for example align the bottom of your spinner with your EditText's

Community
  • 1
  • 1
Carp Fisherman
  • 141
  • 1
  • 3
  • 17
0

You change the dimensions of a View in code using setLayoutParams():

myView.setLayoutParams(new LinearLayout.LayoutParams(widthInPx, heightInPx));

In this example, the parent of the view is a LinearLayout. If you are using a table, you're probably looking for TableRow.LayoutParams.

See this post for more on this topic: How to resize a custom view programmatically?

Community
  • 1
  • 1