Я пытаюсь помещать собственное пространство имен XML в styles.xml
и наследовать его в макете. Я не знаю, как объявить пользовательское пространство имен XML в styles.xml
, как это делается в макете xml (например, xmlns:app="http://schemas.android.com/tools"
).
Как использовать собственное пространство имен XML в styles.xml
?
Что у меня:
-
Атрибут font,
ReallyCoolFont.ttf
сохраняется вasset/fonts
. -
my_layout.xml
:<TextView <!-- more attributes here --> app:customFont="fonts/ReallyCoolFont.ttf" <!-- more attributes here --> </TextView>
-
styles.xml
:<style name="CoolTextView"> <!-- more items here --> <!-- more items here --> </style>
Что бы я хотел:
-
my_layout.xml
:<TextView <!-- more attributes here --> style="@style/CoolTextView <!-- more attributes here --> </TextView>
-
styles.xml
:<style name="CoolTextView"> <!-- more items here --> <item name="app:customFont">ReallyCoolFont.ttf</item> <!-- more items here --> </style>
Ошибка:
Error:(1403, 21) No resource found that matches the given name: attr 'app:customFont'.