pixate-freestyle-android define style class in XML layout

270 Views Asked by At

I'm using the pixate-freestyle-android library in my app. I want to define style class in XML layout.

In docs I found the following:

// Setting a class for a Button
Pixate.setStyleClass(button, "myButton");

This is equivalent to defining a class in the XML layout.

<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:

<Button
    ...
    class="myButton"
    ... />

Is it possible to define style class in XML layout?

2

There are 2 best solutions below

0
ilyamuromets On BEST ANSWER

Attribute class="myButton" can no longer be set in the latest version of library, only programmatically.

0
Srijith On

Put this xmlns:app="http://schemas.android.com/apk/res/com.pixate.freestyle" in your root layout inorder to access the library's class.