Я хочу использовать кнопку переключателя в своем приложении. Поскольку его API составляет 11, а коммутатор нуждается в API выше 14, я решил использовать методы merge
и include
, но я получаю эту ошибку в файле values-v14/compound_switch.xml
: Element merge must be declerd
. вот мои файлы, в чем проблема?Android - слияние и включение
Компонов:
<include layout="@layout/compound_switch" />
макет/compound_switch.xml
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/night_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/textView20"
android:layout_toLeftOf="@+id/textView20"
android:layout_toStartOf="@+id/textView20"
android:layout_marginRight="5dp"
android:checked="false" />
</merge>
значения-v14/compound_switch.xml
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Switch
android:id="@+id/night_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/textView20"
android:layout_toLeftOf="@+id/textView20"
android:layout_toStartOf="@+id/textView20"
android:layout_marginRight="5dp" />
</merge>