Skip to content

[Feature Request] Posibility of mat-prefix and mat-suffix icons in textfield #32

Open

Description

@inONEL

It would be nice if we could add material icons to the textfield

Activity

  1. kryoware commented on Nov 9, 2020

    @kryoware

    Just in case someone still needs this. Not sure if this is the right way to do it tho. Tested on Android 9 - NS 6.x

    Code

    import { android as androidApp } from 'tns-core-modules/application'
    
    ...
    
    // loaded event
    textFieldLoaded({ object }) {
        // Grab Native view
        const inputLayout = object.android
        // Grab icon from res (replace "com.example.app" with your package name. "ic_add" with your icon name)
        const icon = com.example.app.R.drawable.ic_add
        // Convert it into a drawable for android
        const iconDrawable = androidApp.context.getResources().getDrawable(icon)
    
        inputLayout.setPrefixText("+63 ")
        inputLayout.setStartIconDrawable(iconDrawable)
    }

    Result

    Screenshot_20201109-114631

  2. farfromrefug commented on Nov 9, 2020

    @farfromrefug
    Member

    @kryoware I think it is the right way. Want to make a PR to add that both on iOS and Android ?

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions