Friday, 10 September 2021

Find your machine/computer/laptop IP address

To find your machine/computer/laptop IP address follow these steps.

    1. Search for cmd in the search bar

    2. Type ipconfig command and press Enter button

    Watch video



Thursday, 9 September 2021

How to change View/Button/Layout background color in android while maintaining effects and state color ?

 This tutorial will answer following questions:

  1.   Difference between android:background & android:backgroundTint in android
  2.   Why background color is not applying to Views/Buttons in android
  3.   Why android:background is not working in android?
  4.   Why button background color is not changing ?
  5.   Difference between  app: and android: prefix, used in android XML layouts

android:background & android:backgroundTint are two very important and confusing properties. Both are used for background styling of a View/Layout/Button. Here, I am listing some important points  about the functionality these properties/attributes.

    1. Both are used to change background color of a View/Button/Layout.
    2. android:background applies a color or a full drawable resource (PNG image, XML state list description) to the background, while android:backgroundTint is only used for coloring the background    
    3. android:backgroundTint is having high priority than android:background i-e if you set both of these attributes/properties for a view, android:backgroundTint will affect/apply while android:background will not. 
    4. If android:background attribute/property is used for changing background color, the default click effect behavior (view/button rounded corners and default selection states) of the view will be lost.
    5. use android:background for background resource(PNG/XML) setting and android:backgroundTint for color changing
    6. Use backgroundTint instead of background, until unless there is some special need (e-g wanna to change background image for a View).
    7. By default, Views/buttons/layouts usually use custom/support-library values (purple color +some padding) for backgroundTint property so if you wanna to change it by using/setting  android:backgroundTint property, it will not work. It's because app:backgroundTint (default one) have high priority than android:backgroundTint. So to replicate the changes, you will have to do  one of the following:                                           
      • Disable its custom values in the res->values->themes->themes.xml OR          
      • Use app:backgroundTint instead of android:backgroundTint