Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting style overrides attributes in XML layout #167

Open
UkiUros opened this issue Oct 26, 2022 · 0 comments
Open

Setting style overrides attributes in XML layout #167

UkiUros opened this issue Oct 26, 2022 · 0 comments

Comments

@UkiUros
Copy link

UkiUros commented Oct 26, 2022

If using my custom view, with some attributes (like gravity, maxLines, etc.) in the XML layout file and set some style for it using Paris lib, all these attributes are getting reset even when they are not in the new style.

Example:

<com.example.views.CustomTextView
    android:id="@+id/textViewFeedback"
    style="@style/Headline2"
    android:layout_width="@dimen/custom_diameter"
    android:layout_height="@dimen/custom_diameter"
    android:gravity="center"
    android:maxLines="3"
    android:paddingLeft="30dp"
    android:paddingRight="30dp"/>

If I set a new style using this line of code textViewFeedback.style(R.style.Headline1), attributes like gravity are getting overriden even if I do not have that field in my new style Headline1.

Is there a way to preserve these values?

P.S. I actually have more complex logic within the custom view, where I set the styles in the init block, for some cases, but I do not use any custom attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant