onLinkClick never called
Opened this issue · 1 comments
indywidualny commented
I tried to implement OnLinkClickListener to handle clicks of HTML links. Unfortunately it doesn't work. Links are highlighted correctly but onLinkClick(String url)
is never called after clicking a link.
My layout hierarchy:
<ScrollView
<LinearLayout
<TextView />
<View />
<TextView />
<View />
<uk.co.deanwild.flowtextview.FlowTextView>
<ImageView />
</uk.co.deanwild.flowtextview.FlowTextView>
</LinearLayout>
</ScrollView>
Some code:
public class RssFragment extends Fragment implements OnLinkClickListener {
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
// ...
Spanned html = Html.fromHtml(rss.getSummary() + rss.getDescription(),
new RssImageGetter(getActivity()), null);
flowTextView.setText(html);
flowTextView.setOnLinkClickListener(this);
}
@Override
public void onLinkClick(String url) {
Log.e("Click", url);
}
Has anyone any idea what's wrong?
congxc commented
please add fun:
public boolean onTouchEvent(MotinEvent event){
mClickHandler.onTouch(this,event);
return super.onTouchEvent(event);
} in FlowTextView.java;
and change fun
public boolean onTouch(View view,MotionEvent event){
...
if(distance < 10){
if(event_code == MotionEvent.ACTION_DOWN){
...
}
}
...
} in ClickHandler.java