ViH
ViH

Reputation: 447

Android: Switch controls are not correctly displayed on Samsung devices

I have a problem with Switch controls. They are not correctly displayed on some devices. Please see the following image:

enter image description here

And it's code:

<LinearLayout
   android:orientation="horizontal"
   android:layout_width="match_parent"
   android:layout_height="wrap_content">
   <Switch                        
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Full screen"
        android:id="@+id/optionFullscreen"
        android:layout_margin="10dp"
        android:onClick="onOptionBtClick"
        android:checked="false" />
</LinearLayout>

Could you please help, is it possible to make this ON/OFF trigger max width not take more than about 40%?

Upvotes: 0

Views: 137

Answers (2)

ViH
ViH

Reputation: 447

The problem was with long texts. I solved it by setting my own text:

android:textOn="I"
android:textOff="O"

Upvotes: 1

bvanvelsen - ACA Group
bvanvelsen - ACA Group

Reputation: 1751

You can set the android:switchMinWidth="50dp" attribute on your switch widget. that will make it smaller

Upvotes: 0

Related Questions