2014-11-20 5 views
0

Как вы устанавливаете ресурсы, такие как textOff?android-switch-backport - как вы устанавливаете ресурсы?

Я начал с примера android-switch-backport-master/sample и модифицированного RES/макет/main.xml следующим образом:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:switch="http://schemas.android.com/apk/res/org.jraf.android.backport.switchwidget.sample" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context=".MainActivity" > 

    <org.jraf.android.backport.switchwidget.Switch 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textOff="test" 
     switch:asb_switchTextOff="@string/foo" 
     /> 

</LinearLayout> 

Примечание дополнениями xmlns:switch="http://schemas.android.com/apk/res/org.jraf.android.backport.switchwidget.sample" и switch:asb_switchTextOff="@string/foo". (@ string/foo определяется в другом месте).

Компилятор кажется счастливым, однако состояние «выключено» коммутатора все еще говорит «Выкл.». Есть что-то еще, что мне нужно сделать?

+0

Или я должен полностью забыть этот задний порт и использовать библиотеку совместимости v7? –

ответ

0

ОК, я понял. Публикуется здесь для других, у кого есть тот же вопрос:

Ресурс asb_textOff, а не asb_switchTextOff. Последнее относится к switchpreferences.

<org.jraf.android.backport.switchwidget.Switch 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textOff="test" 
    switch:asb_textOff="@string/foo" 
    /> 
Смежные вопросы