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










share|improve this question




























    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










    share|improve this question


























      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










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 18 at 9:00









      Kling Klang

      32.1k156287




      32.1k156287










      asked Nov 18 at 8:54









      Elad Benda

      12.6k58179330




      12.6k58179330
























          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"






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            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

























            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"






            share|improve this answer

























              up vote
              0
              down vote













              Try to replace android:padding="?attrs/disc_padding"



              with android:padding="?attr/disc_padding" or android:padding="?disc_padding"






              share|improve this answer























                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"






                share|improve this answer












                Try to replace android:padding="?attrs/disc_padding"



                with android:padding="?attr/disc_padding" or android:padding="?disc_padding"







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 18 at 9:46









                Dewey Reed

                446410




                446410






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin