I’m trying to render an EditText password field followed by a Checkbox whose text is “show?”. Both are in a horizontally-oriented LinearLayout.
I want the checkbox and its label to occupy exactly as much space as they need to render without squishing, wrapping, or mangling — no more, no less — and give the remainder of the row’s width to the EditText.
Is there some semi-magic layout_weight value that literally means (on its own, or in combination with one or more other attributes) “give this element exactly as much width as it needs to render normally without squishing, wrapping, or manging — but no more?” And another that means “give this element all available space that remains after satisfying everything else first”?
All you need to do is set
android:layout_width="wrap_content”on both controls and setandroid:layout_weight="1"on the EditText.