Solutions to remove focus of textView and request focus(android)


By default when there is a textview (in android) it has focus so soft keyboard is open and the cursor is blinking in the text view when page shown.

 <StackLayout  (tap)="toggle()" >
        <TextView  [text]="footext" ></TextView>
        <WebView  [src]="foo" #webView ></WebView>

my solution to fix that:

@ViewChild("webView") webView:any ;

and in ngAfterViewInit we request focus for webview and keboard and blinking cursor will not show at the beginig of page show.

public ngAfterViewInit(){
    if( { // in IOS android will be undefined

now textview has not focus but if press on that it will get focus again.

I want to do something to remove focus when I press out of it.

so I added already (tap)="toggle()" in stacklayout ,I’ll use it.


now if I tap out of textview the focus of it will be removed. :slight_smile:

please share any other solution you know for that. :slight_smile: