shankey shankey - 23 days ago 7
Android Question

How to Remove Underline from hyperlink's text in android ?

I have Button and its text, I retrive it from string.xml i.e.
I have declared a Button text in res/values in strings.xml like

<string name="Google"><a href=""http://www.google.com\">Google</a></string>


I removed its text color from blue to white but how do I remove its underline?
in my .java file I am using only
setMovementMethod(LinkMovementMethod.getInstance());
to make the link clickabale... I didn't use
Linkify
, webview or anything like form.Html...
everything works fine. I just want to remove the underline below that "Google" text...
Is there any way to do this in the xml?

I even used
android:autoLink="all"
. But when I used that, the text and button color changes and I dont want that.

Please Help.

Answer

after trying a lot finally i found the solution. I removed the link from string.xml and added this code in my java file.

Button btnGoogle = ( Button GoogleAlert.findViewById(
                R.id.btnGoogle );
            btnGoogle.setMovementMethod(
                LinkMovementMethod.getInstance() );
            btnGoogle.setOnClickListener( new OnClickListener()
            {
                @Override
                public void onClick( View v )
                {        
                    Uri uri = Uri.parse(
                        "http://www.google.com" );
                    Intent intent = new Intent( Intent.ACTION_VIEW, uri );
                    startActivity( intent );
                    buyAlert.dismiss();
                }
            } );

and it worked perfectly.