Android hyperlinks on TextView in custom AlertDialog not clickable

前端 未结 3 1603
别那么骄傲
别那么骄傲 2020-12-11 05:37

Following my previous question I still have problems managing hyperlinks on my custom AlertDialog but I believe I narrowed down the problem because I think it o

3条回答
  •  伪装坚强ぢ
    2020-12-11 05:52

    Anyway, your code works perfectly,...

    Code for AlertDialog:

    LayoutInflater inflater = LayoutInflater.from(ctx);
    View layout = inflater.inflate(R.layout.info, null);
    AlertDialog.Builder about = new AlertDialog.Builder(ctx);
    about.setTitle("Data");
    about.setIcon(R.drawable.info);
    
    // Make the textview clickable. Must be called after show()
    TextView textView = (TextView) layout.findViewById(R.id.infoDetailText);
    textView.setText(R.string.link_text_manual);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    about.setView(layout);
    AlertDialog displayInfo = about.create();
    displayInfo.show();
    

    Code of TextView XML:

    
    

    Removed two attributes..

    android:autoLink="all"
    android:linksClickable="true"
    

提交回复
热议问题