custom attribute not found in my custom View
up vote
-1
down vote
favorite
I have this line in my account_particle.xml layout
android:padding="?attrs/disc_padding"
this attrs.xml:
<resources>
<declare-styleable name="AccountParticle">
<attr name="text_margin_start" format="reference"/>
<attr name="disc_padding" format="reference"/>
<attr name="disc_imageViewSize" format="reference"/>
</declare-styleable>
</resources>
and this styles.xml:
<style name="Theme.ap.header" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_header_signed_in_avatar_margin_start</item>
</style>
<style name="Theme.ap.list_item" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_account_list_item_avatar_margin_start</item>
</style>
Why do i get this compilation error?
error: Error: No resource found that matches the given name (at 'padding' with value '?attrs/disc_padding').
AccountParticle
android styles android-custom-view custom-attributes
add a comment |
up vote
-1
down vote
favorite
I have this line in my account_particle.xml layout
android:padding="?attrs/disc_padding"
this attrs.xml:
<resources>
<declare-styleable name="AccountParticle">
<attr name="text_margin_start" format="reference"/>
<attr name="disc_padding" format="reference"/>
<attr name="disc_imageViewSize" format="reference"/>
</declare-styleable>
</resources>
and this styles.xml:
<style name="Theme.ap.header" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_header_signed_in_avatar_margin_start</item>
</style>
<style name="Theme.ap.list_item" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_account_list_item_avatar_margin_start</item>
</style>
Why do i get this compilation error?
error: Error: No resource found that matches the given name (at 'padding' with value '?attrs/disc_padding').
AccountParticle
android styles android-custom-view custom-attributes
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have this line in my account_particle.xml layout
android:padding="?attrs/disc_padding"
this attrs.xml:
<resources>
<declare-styleable name="AccountParticle">
<attr name="text_margin_start" format="reference"/>
<attr name="disc_padding" format="reference"/>
<attr name="disc_imageViewSize" format="reference"/>
</declare-styleable>
</resources>
and this styles.xml:
<style name="Theme.ap.header" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_header_signed_in_avatar_margin_start</item>
</style>
<style name="Theme.ap.list_item" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_account_list_item_avatar_margin_start</item>
</style>
Why do i get this compilation error?
error: Error: No resource found that matches the given name (at 'padding' with value '?attrs/disc_padding').
AccountParticle
android styles android-custom-view custom-attributes
I have this line in my account_particle.xml layout
android:padding="?attrs/disc_padding"
this attrs.xml:
<resources>
<declare-styleable name="AccountParticle">
<attr name="text_margin_start" format="reference"/>
<attr name="disc_padding" format="reference"/>
<attr name="disc_imageViewSize" format="reference"/>
</declare-styleable>
</resources>
and this styles.xml:
<style name="Theme.ap.header" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_header_signed_in_avatar_margin_start</item>
</style>
<style name="Theme.ap.list_item" parent="Theme.AppCompat">
<item name="disc_padding">@dimen/account_menu_account_list_item_avatar_margin_start</item>
</style>
Why do i get this compilation error?
error: Error: No resource found that matches the given name (at 'padding' with value '?attrs/disc_padding').
AccountParticle
android styles android-custom-view custom-attributes
android styles android-custom-view custom-attributes
edited Nov 18 at 9:00
Kling Klang
32.1k156287
32.1k156287
asked Nov 18 at 8:54
Elad Benda
12.6k58179330
12.6k58179330
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try to replace android:padding="?attrs/disc_padding"
with android:padding="?attr/disc_padding"
or android:padding="?disc_padding"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try to replace android:padding="?attrs/disc_padding"
with android:padding="?attr/disc_padding"
or android:padding="?disc_padding"
add a comment |
up vote
0
down vote
Try to replace android:padding="?attrs/disc_padding"
with android:padding="?attr/disc_padding"
or android:padding="?disc_padding"
add a comment |
up vote
0
down vote
up vote
0
down vote
Try to replace android:padding="?attrs/disc_padding"
with android:padding="?attr/disc_padding"
or android:padding="?disc_padding"
Try to replace android:padding="?attrs/disc_padding"
with android:padding="?attr/disc_padding"
or android:padding="?disc_padding"
answered Nov 18 at 9:46
Dewey Reed
446410
446410
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359238%2fcustom-attribute-not-found-in-my-custom-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown