Skip to content

Background-color not showing correctly in Android 4.2 #1638

Closed

Description

@gfalves

When setting the background color for a button in the CSS file, the color goes to a "light" version on Android 4.2. When the button is tapped, the color is shown correctly for that fraction of second.

In Android 5.0 onwards, this problem does not occur.

This happens in version 1.6.1 of TNS. Before I had the 1.5.1 version and this problem didn't happen.

This was tested with Nexus 7 (2012) with Android 4.4, and a phone with Android 4.2. For emulators it was tested with genymotion and android official emulator with android versions 4.2 to 6.0.
emulator android 4 2
emulator android 5

Activity

  1. enchev commented on Feb 25, 2016

    @enchev
    Contributor

    Hey @gfalves,

    I believe that this is related to #1296

    Long story short we kept the default background drawable vs previous version where the Button background was completely replaced with solid color. Now the background drawable will be only colorized. If you still need the previous behavior you can set for example border-width:0.1.

  2. gfalves commented on Feb 25, 2016

    @gfalves
    Author

    Hi @enchev ,

    Thank you for the tip. It works now!

    I am new in "software dev" and I am learning as I go, so it is still difficult for me to see the logic in your explanation. But why does this only happen in Android previous to 5.0? Is it supposed to?

    By the way, who marks this as resolved? Me? You? Or other NativeScript responsable?

    Thank you once again.

  3. enchev commented on Feb 25, 2016

    @enchev
    Contributor

    In my opinion the difference comes from the fact that Android themes for Button in 4.2 and 6.0 are different. The idea of our fix was to not override the default button background but just apply the color to the existing background. In different versions of Android backgrounds for buttons are different and for example may nice ripple effect and we don't want to override this with just a solid color.

    Either you or I can close this issue (or some other collaborator of this repo).

  4. gfalves commented on Feb 25, 2016

    @gfalves
    Author

    Cool. Thanks =)

  5. Rohitwithyou commented on May 29, 2018

    @Rohitwithyou

    I am still facing the problem ,when i try to set the background color in textview.

  6. lock commented on Aug 26, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked and limited conversation to collaborators on Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions