how does android handles and prioritize xml attribute overlaps between API versions The 2019 Stack Overflow Developer Survey Results Are InStandard Android Button with a different colorHow do I pass data between Activities in Android application?Retrieving Android API version programmaticallySelector on background color of TextViewHow to get the build/version number of your Android application?How to customize the back button on ActionBarMipmap drawables for iconsAndroid Material Design Button StylesColoring Buttons in Android with Material Design and AppCompatChanging EditText bottom line color with appcompat v7

How to type a long/em dash `—`

Getting crown tickets for Statue of Liberty

What is the most efficient way to store a numeric range?

Deal with toxic manager when you can't quit

Straighten subgroup lattice

Dropping list elements from nested list after evaluation

Does HR tell a hiring manager about salary negotiations?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

Does adding complexity mean a more secure cipher?

How much of the clove should I use when using big garlic heads?

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Time travel alters history but people keep saying nothing's changed

Did any laptop computers have a built-in 5 1/4 inch floppy drive?

Kerning for subscripts of sigma?

Pokemon Turn Based battle (Python)

How to obtain a position of last non-zero element

Geography at the pixel level

If my opponent casts Ultimate Price on my Phantasmal Bear, can I save it by casting Snap or Curfew?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Why does the nucleus not repel itself?

Finding the area between two curves with Integrate

How can I have a shield and a way of attacking with a ranged weapon at the same time?

Mathematics of imaging the black hole

Why doesn't UInt have a toDouble()?



how does android handles and prioritize xml attribute overlaps between API versions



The 2019 Stack Overflow Developer Survey Results Are InStandard Android Button with a different colorHow do I pass data between Activities in Android application?Retrieving Android API version programmaticallySelector on background color of TextViewHow to get the build/version number of your Android application?How to customize the back button on ActionBarMipmap drawables for iconsAndroid Material Design Button StylesColoring Buttons in Android with Material Design and AppCompatChanging EditText bottom line color with appcompat v7



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a button on my app. I want this button to have a simple animation when clicked and a custom background color. Android button has by default a serie of animations when the button is clicked.



There are 3 methods that I tried that changes the color of the button. The "best" one is



android:backgroundTint



However it is only available from API 21 and higher. I consider it the best one because it keeps the default android onclick animation (shadow, color change, etc).



As it is only available from API 21 I added the line



android:background



The problem is that this attribute does not keep the default android onClick animation. When the 2 attributes are put together the background attribute is taking over the backgroundTint one.



Last stuff I did was to set up a drawable that will change the color of the button on click. The drawable is put in the android:background attribute. It is working fine however this time if the 2 attributes, background and backgroundTint are present, the background drawable is not taking action, acting like a background attribute set up without selector.



From that I would like to know how does android handles the attributes overlap in the different API versions?










share|improve this question






















  • I think you can define that with a custom background shape. It provides you with the pressed state

    – Vivek Mishra
    Mar 8 at 11:11











  • Yeah that is what I did, the third point of the post, but when coupled with the backgroundTint attribute, the selector in the cutsom model does not work, so I would like to know how android handles it when xml attributes are overlaping in term of funcrionnalities (here background and backgroundtint)

    – Mayeul sgc
    Mar 8 at 20:09

















0















I have a button on my app. I want this button to have a simple animation when clicked and a custom background color. Android button has by default a serie of animations when the button is clicked.



There are 3 methods that I tried that changes the color of the button. The "best" one is



android:backgroundTint



However it is only available from API 21 and higher. I consider it the best one because it keeps the default android onclick animation (shadow, color change, etc).



As it is only available from API 21 I added the line



android:background



The problem is that this attribute does not keep the default android onClick animation. When the 2 attributes are put together the background attribute is taking over the backgroundTint one.



Last stuff I did was to set up a drawable that will change the color of the button on click. The drawable is put in the android:background attribute. It is working fine however this time if the 2 attributes, background and backgroundTint are present, the background drawable is not taking action, acting like a background attribute set up without selector.



From that I would like to know how does android handles the attributes overlap in the different API versions?










share|improve this question






















  • I think you can define that with a custom background shape. It provides you with the pressed state

    – Vivek Mishra
    Mar 8 at 11:11











  • Yeah that is what I did, the third point of the post, but when coupled with the backgroundTint attribute, the selector in the cutsom model does not work, so I would like to know how android handles it when xml attributes are overlaping in term of funcrionnalities (here background and backgroundtint)

    – Mayeul sgc
    Mar 8 at 20:09













0












0








0


1






I have a button on my app. I want this button to have a simple animation when clicked and a custom background color. Android button has by default a serie of animations when the button is clicked.



There are 3 methods that I tried that changes the color of the button. The "best" one is



android:backgroundTint



However it is only available from API 21 and higher. I consider it the best one because it keeps the default android onclick animation (shadow, color change, etc).



As it is only available from API 21 I added the line



android:background



The problem is that this attribute does not keep the default android onClick animation. When the 2 attributes are put together the background attribute is taking over the backgroundTint one.



Last stuff I did was to set up a drawable that will change the color of the button on click. The drawable is put in the android:background attribute. It is working fine however this time if the 2 attributes, background and backgroundTint are present, the background drawable is not taking action, acting like a background attribute set up without selector.



From that I would like to know how does android handles the attributes overlap in the different API versions?










share|improve this question














I have a button on my app. I want this button to have a simple animation when clicked and a custom background color. Android button has by default a serie of animations when the button is clicked.



There are 3 methods that I tried that changes the color of the button. The "best" one is



android:backgroundTint



However it is only available from API 21 and higher. I consider it the best one because it keeps the default android onclick animation (shadow, color change, etc).



As it is only available from API 21 I added the line



android:background



The problem is that this attribute does not keep the default android onClick animation. When the 2 attributes are put together the background attribute is taking over the backgroundTint one.



Last stuff I did was to set up a drawable that will change the color of the button on click. The drawable is put in the android:background attribute. It is working fine however this time if the 2 attributes, background and backgroundTint are present, the background drawable is not taking action, acting like a background attribute set up without selector.



From that I would like to know how does android handles the attributes overlap in the different API versions?







android xml






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 11:03









Mayeul sgcMayeul sgc

3471621




3471621












  • I think you can define that with a custom background shape. It provides you with the pressed state

    – Vivek Mishra
    Mar 8 at 11:11











  • Yeah that is what I did, the third point of the post, but when coupled with the backgroundTint attribute, the selector in the cutsom model does not work, so I would like to know how android handles it when xml attributes are overlaping in term of funcrionnalities (here background and backgroundtint)

    – Mayeul sgc
    Mar 8 at 20:09

















  • I think you can define that with a custom background shape. It provides you with the pressed state

    – Vivek Mishra
    Mar 8 at 11:11











  • Yeah that is what I did, the third point of the post, but when coupled with the backgroundTint attribute, the selector in the cutsom model does not work, so I would like to know how android handles it when xml attributes are overlaping in term of funcrionnalities (here background and backgroundtint)

    – Mayeul sgc
    Mar 8 at 20:09
















I think you can define that with a custom background shape. It provides you with the pressed state

– Vivek Mishra
Mar 8 at 11:11





I think you can define that with a custom background shape. It provides you with the pressed state

– Vivek Mishra
Mar 8 at 11:11













Yeah that is what I did, the third point of the post, but when coupled with the backgroundTint attribute, the selector in the cutsom model does not work, so I would like to know how android handles it when xml attributes are overlaping in term of funcrionnalities (here background and backgroundtint)

– Mayeul sgc
Mar 8 at 20:09





Yeah that is what I did, the third point of the post, but when coupled with the backgroundTint attribute, the selector in the cutsom model does not work, so I would like to know how android handles it when xml attributes are overlaping in term of funcrionnalities (here background and backgroundtint)

– Mayeul sgc
Mar 8 at 20:09












0






active

oldest

votes












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',
autoActivateHeartbeat: false,
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%2f55061865%2fhow-does-android-handles-and-prioritize-xml-attribute-overlaps-between-api-versi%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061865%2fhow-does-android-handles-and-prioritize-xml-attribute-overlaps-between-api-versi%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

1928 у кіно

Захаров Федір Захарович

Ель Греко