Adding “app:” attributes to a custom style in Android [duplicate]
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>
android android-styles
marked as duplicate by Mike M.
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.
|
show 3 more comments
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>
android android-styles
marked as duplicate by Mike M.
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 theapp:
prefix; e.g.,<item name="chipCornerRadius">...</item>
.
– Mike M.
Nov 25 '18 at 12:36
@MikeM. Using a style with theapp:
prefix removed does not work for the example above withChip
.
– 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 theChip
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
|
show 3 more comments
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>
android android-styles
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
android android-styles
asked Nov 25 '18 at 12:32
adriennoiradriennoir
181114
181114
marked as duplicate by Mike M.
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.
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 theapp:
prefix; e.g.,<item name="chipCornerRadius">...</item>
.
– Mike M.
Nov 25 '18 at 12:36
@MikeM. Using a style with theapp:
prefix removed does not work for the example above withChip
.
– 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 theChip
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
|
show 3 more comments
1
Just remove theapp:
prefix; e.g.,<item name="chipCornerRadius">...</item>
.
– Mike M.
Nov 25 '18 at 12:36
@MikeM. Using a style with theapp:
prefix removed does not work for the example above withChip
.
– 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 theChip
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
|
show 3 more comments
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 withChip
.– 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