8

Attributes prefixed by "android" work fine, but how do I add the ones prefixed by something else?

For example, how can I add the following two attributes to the style bellow?

app:chipCornerRadius="20dp"
app:textStartPadding="8dp"

<style name="Chip" parent="Base.TextAppearance.AppCompat.Small">
    <item name="android:textSize">@dimen/smallTextSize</item>
    <item name="android:textColor">@color/black</item>
</style>
8
  • 7
    Just remove the app: prefix; e.g., <item name="chipCornerRadius">...</item>. Commented Nov 25, 2018 at 12:36
  • 1
    @MikeM. Using a style with the app: prefix removed does not work for the example above with Chip. Commented Nov 25, 2018 at 13:21
  • Then you've got some other issue. There is no other way to specify app-local attributes. Make sure you've got whichever library you're using added correctly, that you have the attribute names spelled correctly, and that you're using a version that actually offers those attributes. Commented Nov 25, 2018 at 13:24
  • @MikeM. It's about the Chip from the support library and the attributes are spelled correctly. The attributes work fine if I add them to a chip in my layout but will not work if I add them to a style and apply the style. Commented Nov 25, 2018 at 14:28
  • What exactly do you mean by "will not work"? Are you getting a build error, or a runtime error? Commented Nov 25, 2018 at 14:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.