[英]pixate-freestyle-android define style class in XML layout
I'm using the pixate-freestyle-android library in my app. 我在我的应用程序中使用pixate-freestyle-android库。 I want to define style class in XML layout. 我想在XML布局中定义样式类。
In docs I found the following: 在docs中,我发现了以下内容:
// Setting a class for a Button
Pixate.setStyleClass(button, "myButton");
This is equivalent to defining a class in the XML layout. 这等效于在XML布局中定义一个类。
<Button
class="myButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/myButtonStr"
android:textSize="16sp" />
If I define those programmatically in code - it works. 如果我以编程方式在代码中定义这些内容,则可以正常工作。 But if I define those in XML layout, like above, Android Studio indicates me " Unknown attribute class " at this line and it doesn't work: 但是,如果我像上面那样在XML布局中定义它们,Android Studio会在这一行指示我“ Unknown attribute class ”,它不起作用:
<Button
...
class="myButton"
... />
Is it possible to define style class in XML layout? 是否可以在XML布局中定义样式类?
将此xmlns:app="http://schemas.android.com/apk/res/com.pixate.freestyle"
放在根目录中,以便访问库的类。
只能以编程方式在最新版本的库中不再设置属性class =“ myButton” 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.