Linkify的方法,可点击列表视图块Click方法
您好我有每一行与TextView的列表视图与定义的模式linkified在里面,我用这个小code键使linkified项目可以点击和我之前调用另一个活动在我app.But文本现在用imaview列表上方以使导航出现在列表视图,当我加入
Hi i have a listview with textview in every row with a text linkified with defined pattern in it , i use this small code to make linkified items can be clickable and call another activity in my app.But before that i am using imaview above the list to make navigation appear on listview , when i added
textView.setMovementMethod(LinkMovementMethod.getInstance());
Pattern Matcher = Pattern.compile("pattern here");
String Url = "sth://";
Linkify.addLinks(entrySpan, Matcher, Url);
而不是在仅仅linkfy点击的工作列表视图的OnClick方法,但我必须让他们的工作BOT
Instead of onClick method of listview on just linkfy clicks are working , but i have to make them work bot
下面是code,我使用了列表视图点击的方法,但这种似乎从来射击设置linkify集运动之后,我来回切换之间的可见和每次点击后消失了。
Here is code that i am using for listview click method but this seems never firing after setting linkify set movement , i am switching back and forth between Vısıble and Gone after every click.
getListView().setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
if(Entry.totalPageNumber>1){
//if no more than one page exist no need to navigate
if(show == false){
findViewById(R.id.back).setVisibility(View.VISIBLE);
findViewById(R.id.forward).setVisibility(View.VISIBLE);
findViewById(R.id.start).setVisibility(View.VISIBLE);
findViewById(R.id.last).setVisibility(View.VISIBLE);
show=true;
}else if(show==true){
findViewById(R.id.back).setVisibility(View.GONE);
findViewById(R.id.forward).setVisibility(View.GONE);
findViewById(R.id.start).setVisibility(View.GONE);
findViewById(R.id.last).setVisibility(View.GONE);
show=false;
}
}
}
});
如何解决这个问题?
How to resolve this problem??
我解决了它,只是感动onClickListener实施成画的TextView和直接应用onClickListener到TextView的,最后他们都愉快地工作我getView方法
I resolved it , just moved the onClickListener implementation into my getView method which draw textview and directly apply onClickListener to textView and finally both of them working happily
TextView textView = (TextView) mView.findViewById(R.id.entryRowTextView);
textView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
if(Entry.totalPageNumber>1){
//if no more than one page exist no need to navigate
Log.d(EKSI, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
if(show == false){
findViewById(R.id.back).setVisibility(View.VISIBLE);
findViewById(R.id.forward).setVisibility(View.VISIBLE);
findViewById(R.id.start).setVisibility(View.VISIBLE);
findViewById(R.id.last).setVisibility(View.VISIBLE);
show=true;
}else if(show==true){
findViewById(R.id.back).setVisibility(View.GONE);
findViewById(R.id.forward).setVisibility(View.GONE);
findViewById(R.id.start).setVisibility(View.GONE);
findViewById(R.id.last).setVisibility(View.GONE);
show=false;
}
}
}
});