I set the width of my LinearLayout's childs as percentages of the layout.
It displays fine on 7 and 10 inches screens, but on 5 inches, the given percentage yields a width too small for the text.
The child's minWidth attribute is ignored.
How can I set a minimum width on a child ?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_file_seek_bar"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:weightSum="100"
android:gravity="center_vertical">
<TextView
android:id="@+id/textView_file_playing_time"
android:layout_width="0dp"
android:layout_weight="8"
android:minWidth="100dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff"
android:text="00:00"
android:layout_marginLeft="15dp"
/>
<SeekBar
android:id="@+id/seek_bar_source_file"
android:layout_width="0dp"
android:layout_weight="92"
android:layout_height="40dp"
android:indeterminate="false"
/>
</LinearLayout>
This Should Work
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_file_seek_bar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:id="@+id/textView_file_playing_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:maxWidth="100dp"
android:text="00:00"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<SeekBar
android:id="@+id/seek_bar_source_file"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="92"
android:indeterminate="false" />
</LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With