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

Change @Styleable param from String to int R.styleable.* #51

Closed
Kolyall opened this issue Jun 6, 2018 · 1 comment
Closed

Change @Styleable param from String to int R.styleable.* #51

Kolyall opened this issue Jun 6, 2018 · 1 comment
Labels

Comments

@Kolyall
Copy link

Kolyall commented Jun 6, 2018

Change param of annotation Styleable from String to int (R.styleable.*), example:

@Styleable(R.styleable.MyView)
public class MyView extends LinearLayout {
@Kolyall Kolyall changed the title Change Styleable param from String to int R.attr.MyView Change Styleable param from String to int R.styleable.* Jun 6, 2018
@Kolyall Kolyall closed this as completed Jun 6, 2018
@Kolyall Kolyall reopened this Jun 6, 2018
@Kolyall Kolyall changed the title Change Styleable param from String to int R.styleable.* Change @Styleable param from String to int R.styleable.* Jun 6, 2018
@ngsilverman
Copy link
Collaborator

@Kolyall I wish that were possible, unfortunately, fields such as R.styleable.MyView are of type int[], not int, as such they are not constant values (the content of the array can be changed) and can't be used as an annotation attribute value per Java rules.

However, styleable declarations usually have the same name as their associated view so we could omit the parameter entirely in favor of a naming configuration, see #3.

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

No branches or pull requests

2 participants