开发者

How to solve : doesn't work toggle when using linkify class in Android?

开发者 https://www.devze.com 2023-04-07 07:03 出处:网络
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List6.html TakingReferece of the above link, whenI test sample and I added linkify getView function, does not

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List6.html

Taking Referece of the above link, whenI test sample and I added linkify getView function, does not work toggle.

public View getView(int position, View convertView, ViewGroup parent) {

            SpeechView sv;           

            if (convertView == null) {
                sv = new SpeechView(mContext, myTitle[position], myContent[position], mExpanded[position]);
            } else {

                sv = (SpeechView)convertView;                
                sv.setTitle(myTitle[position]);
                sv.setDialogue(myContent[position]);
                sv.setExpanded(mExpanded[position]); 

                TextView body = (TextView)sv.getChildAt(1);开发者_开发问答
                body.setTextColor(Color.GRAY); 

                body.setText(myContent[position]);
                Linkify.addLinks(body, Linkify.PHONE_NUMBERS);     

               body.setMovementMethod(LinkMovementMethod.getInstance());                     


            }

            TextView title = (TextView)sv.getChildAt(0);
            title.setTextColor(Color.LTGRAY);              


            return sv;
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消