How can I force my checkbox's text to not wrap?
android-button, android-checkbox, android-layout, android-linearlayout
Solution
CheckBox inherits from CompoundButton, which inherits from Button, which inherits from TextView. So, it has all the properties, methods and attributes of these ancestors... Reference: http://developer.android.com/reference/android/widget/CheckBox.html
In particular, you are interested to the TextView properties, methods and attributes: Reference: http://developer.android.com/reference/android/widget/TextView.html
In particular, you're interested in the `android:lines` attribute, and set it to 1. This tells your CheckBox to be exactly 1 line tall.
You might also want to set the `android:ellipsize` attribute to some value (i.e.: 3 = end). This tells your CheckBox to add three dots (ellipsis) to the end, start, center, ... of the truncated text.
[EDIT]
Being a decentant of TextView, it can use `setSingleLine` - Thanks to @CrandellWS for the comment.
Problem
This is what my LinearLayout (horizontal) row looks like: I want the text of the checkbox to be on one line; The buttons don't have to be that wide - they'll still have plenty of space with the checkbox text lengthened a bit. What in my XML: ``` <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <CheckBox android:id="@+id/ckbxAllow_New_Items" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:checked="true" android:text="@string/checkbox_Allow_New_Items" /> <Button android:id="@+id/btnOK" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/button_OK" /> <Button android:id="@+id/btnCancel" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/button_Cancel" /> </LinearLayout> ``` ...needs to change in order to force my checkbox text not to wrap? UPDATE Following Der Golem's suggestion by adding this: ``` android:lines="1" ``` ...and also changing layout_weight for the checkbox from 1 to 2 (set to 1 for the buttons) gave me what I wanted: