我在我的应用程序中使用pixate-freestyle-android库。我想在 XML 布局中定义样式类。
在文档中,我发现以下内容:
// Setting a class for a Button
Pixate.setStyleClass(button, "myButton");
这相当于在 XML 布局中定义一个类。
<Button
class="myButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/myButtonStr"
android:textSize="16sp" />
如果我在代码中以编程方式定义它们 - 它可以工作。但是,如果我在 XML 布局中定义它们,如上所示,Android Studio 在这一行指示我“未知属性类”,但它不起作用:
<Button
...
class="myButton"
... />
是否可以在 XML 布局中定义样式类?