Nativescript: Change the border-bottom color of a focused text-field

Created on 4 Mar 2016  路  8Comments  路  Source: NativeScript/NativeScript

Tell us about the problem

Is it possible to change the border-bottom (line) color of a text-field?

Screenshot:
image

I want to change that blue color to green, how can I do this?

I've looked in http://developer.android.com/reference/android/widget/EditText.html and http://developer.android.com/reference/android/widget/TextView.html but can't find it.

I'm trying to access these properties/methods with:

email = page.getViewById("email");

var Color = colorModule.Color;
var color = new Color("#19b0a7");

email.android.setTextColor(color.android);
email.android.setHintTextColor(color.android);
email.android.setHighlightColor(color.android);
// which method?

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 1.6.2
  • Cross-platform modules: 1.6.2
  • Runtime(s): 1.6.2
android question

Most helpful comment

I'd like to know the same - can we use :focus or :active somehow in css?

All 8 comments

You can set this by setting the appropriate colors in your colors.xml file in the platform/Android resources. On phone now or I'd send you the snippet and some instructions. I forget if it's the _ns_accent_ or _ns_primary dark_ color that will be applied on lollipop devices.

Thanks @bradmartin

It's ns_accent in \platforms\android\src\main\res\values-v21\colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="ns_accent">#3d5afe</color>
</resources>

But is there a way to do this in \App_Resources\Android\values\strings.xml or programmatically? I don't like changing files in de \platforms\android folder...

@GerjanOnline as of this moment in time there's no way to change this programmatically, it's all got to be done via this file: \platforms\android\src\main\res\values-v21\colors.xml

What about pre lollipop ?

How to make this work with angular? Or is there any update on how to style this?

Is it possible to change other colors (background, border etc) based on whether the text field is open? Like a pseudo selector?

I'd like to know the same - can we use :focus or :active somehow in css?

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mspusta78 picture mspusta78  路  59Comments

atanasovg picture atanasovg  路  50Comments

morningrat picture morningrat  路  67Comments

valentinstoychev picture valentinstoychev  路  136Comments

danielzzz picture danielzzz  路  59Comments