Adding “app:” attributes to a custom style in Android [duplicate]












0
















This question already has an answer here:




  • Custom attributes in styles.xml

    5 answers



  • Extract Support Library layout attributes into styles

    1 answer




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>









share|improve this question













marked as duplicate by Mike M. android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:40


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    Just remove the app: prefix; e.g., <item name="chipCornerRadius">...</item>.

    – Mike M.
    Nov 25 '18 at 12:36













  • @MikeM. Using a style with the app: prefix removed does not work for the example above with Chip.

    – adriennoir
    Nov 25 '18 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.

    – Mike M.
    Nov 25 '18 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.

    – adriennoir
    Nov 25 '18 at 14:28











  • What exactly do you mean by "will not work"? Are you getting a build error, or a runtime error?

    – Mike M.
    Nov 25 '18 at 14:30
















0
















This question already has an answer here:




  • Custom attributes in styles.xml

    5 answers



  • Extract Support Library layout attributes into styles

    1 answer




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>









share|improve this question













marked as duplicate by Mike M. android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:40


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    Just remove the app: prefix; e.g., <item name="chipCornerRadius">...</item>.

    – Mike M.
    Nov 25 '18 at 12:36













  • @MikeM. Using a style with the app: prefix removed does not work for the example above with Chip.

    – adriennoir
    Nov 25 '18 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.

    – Mike M.
    Nov 25 '18 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.

    – adriennoir
    Nov 25 '18 at 14:28











  • What exactly do you mean by "will not work"? Are you getting a build error, or a runtime error?

    – Mike M.
    Nov 25 '18 at 14:30














0












0








0









This question already has an answer here:




  • Custom attributes in styles.xml

    5 answers



  • Extract Support Library layout attributes into styles

    1 answer




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>









share|improve this question















This question already has an answer here:




  • Custom attributes in styles.xml

    5 answers



  • Extract Support Library layout attributes into styles

    1 answer




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>




This question already has an answer here:




  • Custom attributes in styles.xml

    5 answers



  • Extract Support Library layout attributes into styles

    1 answer








android android-styles






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 25 '18 at 12:32









adriennoiradriennoir

181114




181114




marked as duplicate by Mike M. android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:40


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Mike M. android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:40


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1





    Just remove the app: prefix; e.g., <item name="chipCornerRadius">...</item>.

    – Mike M.
    Nov 25 '18 at 12:36













  • @MikeM. Using a style with the app: prefix removed does not work for the example above with Chip.

    – adriennoir
    Nov 25 '18 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.

    – Mike M.
    Nov 25 '18 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.

    – adriennoir
    Nov 25 '18 at 14:28











  • What exactly do you mean by "will not work"? Are you getting a build error, or a runtime error?

    – Mike M.
    Nov 25 '18 at 14:30














  • 1





    Just remove the app: prefix; e.g., <item name="chipCornerRadius">...</item>.

    – Mike M.
    Nov 25 '18 at 12:36













  • @MikeM. Using a style with the app: prefix removed does not work for the example above with Chip.

    – adriennoir
    Nov 25 '18 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.

    – Mike M.
    Nov 25 '18 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.

    – adriennoir
    Nov 25 '18 at 14:28











  • What exactly do you mean by "will not work"? Are you getting a build error, or a runtime error?

    – Mike M.
    Nov 25 '18 at 14:30








1




1





Just remove the app: prefix; e.g., <item name="chipCornerRadius">...</item>.

– Mike M.
Nov 25 '18 at 12:36







Just remove the app: prefix; e.g., <item name="chipCornerRadius">...</item>.

– Mike M.
Nov 25 '18 at 12:36















@MikeM. Using a style with the app: prefix removed does not work for the example above with Chip.

– adriennoir
Nov 25 '18 at 13:21







@MikeM. Using a style with the app: prefix removed does not work for the example above with Chip.

– adriennoir
Nov 25 '18 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.

– Mike M.
Nov 25 '18 at 13:24





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.

– Mike M.
Nov 25 '18 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.

– adriennoir
Nov 25 '18 at 14:28





@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.

– adriennoir
Nov 25 '18 at 14:28













What exactly do you mean by "will not work"? Are you getting a build error, or a runtime error?

– Mike M.
Nov 25 '18 at 14:30





What exactly do you mean by "will not work"? Are you getting a build error, or a runtime error?

– Mike M.
Nov 25 '18 at 14:30












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin