Android TextView Hyperlink

前端 未结 8 746
悲&欢浪女
悲&欢浪女 2021-02-05 03:45

I\'m implementing a TextView with a string containing two hyperlinks as below but the links are not opening a new browser window:



        
8条回答
  •  滥情空心
    2021-02-05 04:15

    I would recommend you to have two TextViews since ou want two different actions:

    TextView yourTermsOfUseTextView = (TextView) findViewById(R.id.your_id);
    yourTermsOfUseTextView.setOnclickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(your_download_link));
                        startActivity(myIntent);
                    }
                });
    

    Repeat to the privacy policy.

提交回复
热议问题