Android Question EditText Background color in the designer

Discussion in 'Android Questions' started by sirjo66, Aug 8, 2015.

  1. sirjo66

    sirjo66 Well-Known Member Licensed User

    Hello everyone,

    in the designer, I have an EditText object, and I want to set text's background color property, but I don't find where I can set it.
    I find Text Color and Hint Color, but where is Background Color property ???

    I use this line in runtime code:
    Code:
    EditText1.Color = Colors.White
    and it works, but how can I do it in the designer ??

    Many thanks
    Sergio

    P.S.: I use B4A 4.00
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Changing the Color property replaces the background drawable to be a simple ColorDrawable. This means that the EditText will no longer look like a standard EditText.
    For that reason it is not available in the designer.
     
  3. sirjo66

    sirjo66 Well-Known Member Licensed User

    Many thanks.
    I have an Activity with black background color, and I want an EditText with black forecolor and white background color. Is it possible by designer ??

    Can you tell me web page where I can study "drawable" concept on B4A ??
    I don't understand very well.

    Thanks
    Sergio
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    There is no simple way to change the EditText color. Not with the designer and not by code. The EditText is based on a nine-patch image so it is not possible to just change its color.

    The simplest way to deal with the colors is to use the default colors. You can change to a light or dark theme in the manifest editor.

    If you like you can replace the EditText background drawable with a different drawable that you provide. Search for BitmapDrawable.
     
  5. sirjo66

    sirjo66 Well-Known Member Licensed User

    many thanks !!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice