greetings,

i have a TableLayout that has a bunch of rows that looks like this:


<TableRow android:id="@+id/ROW_CHOOSE_ANSWER_1">

  <Button android:id="@+id/BUTTON_CHOOSE_ANSWER_1"
          style="@style/cue_minor"
          android:clickable="true"
             android:cursorVisible="false"
             android:layout_height="wrap_content"
             android:layout_weight="45"
             android:layout_width="1dip"
             android:gravity="center|center_vertical"
             />

     <Button android:id="@+id/BUTTON_CHOOSE_ANSWER_2"
             style="@style/cue_minor"
             android:clickable="true"
             android:cursorVisible="false"
             android:layout_height="wrap_content"
             android:layout_weight="45"
             android:layout_width="1dip"
             android:gravity="center|center_vertical"
             />

</TableRow>

the current behavior is such that if the text of the first button
wraps to the second line, the height of the button will be larger.
this is good. however, the other button, if it does not have that much
text will be smaller.

i would like to have both buttons have the same height --- which is
the maximum height required by the button with the largest amount of
text.

can i do this with layout tags or would i need to do this manually
through code somehow?

i have tried to do this manually, with something like the following:


        Button button =
(Button)findViewById(R.id.BUTTON_CHOOSE_ANSWER_2);
        button.setText("zzzz asldfjlaksdjflks asldfjalskjfalskdjf");
        LayoutParams params = button.getLayoutParams();
        params.height = LayoutParams.WRAP_CONTENT;
        button.setLayoutParams(params);
        int height = button.getHeight();

but the getHeight() call gives me a height of 0. is there some kind of
measure call i can use perhaps?

thanks!
swine

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

Reply via email to