2016-08-10 11 views
1

enter image description hereПочему Switch показывает разные версии Nexus 5 версии 6.0.1?

Выход, как и выше прямо сейчас ... Не показывать РЕЛЕ ..shows только On/Off

Это мой код для коммутатора ...

все другие Выходное устройство Хорошо, но в NExus 5 он показывает вкл/выкл только не переключатель/toggel.

<LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="0.7" 
        android:orientation="horizontal"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_marginLeft="5dp" 
         android:text="Save recorded call? " 
         android:textColor="@color/black" 
         android:textStyle="bold" /> 

        <Switch 
         android:id="@+id/recSwitch" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textOff="Off" 
         android:textOn="On" /> 
       </LinearLayout> 

Заранее спасибо за помощь .. предложения приемлемым ..

+0

использование [switchCompat] (https://developer.android.com/reference/android/support/v7/widget/SwitchCompat.html) вместо переключения – SaravInfern

ответ

1

Добавить в вашей зависимости

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.0.3' 
} 

В вашем XML

<LinearLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:layout_weight="0.7" 
       android:orientation="horizontal"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:text="Save recorded call? " 
        android:textColor="@color/black" 
        android:textStyle="bold" /> 

       <android.support.v7.widget.SwitchCompat 
        android:id="@+id/switch_compat2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Switch Compat" 
        app:showText="false"/> 
      </LinearLayout>