开发者

how to get focus in underlined textview text android

i have created a textview with underline text like this

     <TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text = "@开发者_StackOverflowstring/underline_text"
    android:clickable = "true"
    android:focusable = "true"
    android:focusableInTouchMode="true"
    android:isScrollContainer="true"
    android:textColor = "#0000FF"
    android:layout_marginLeft = "48dp"

/>  

with string mapped to

    <string name="underline_text"><u>Hello</u></string>

i am getting underline text i am not being able to get focus while touching it or while scrolling between views .

Please anyone have any idea how to get this done.

Thanks


setOnFocusChangeListener(new OnFocusChangeListener(){
        @Override
        public void onFocusChange(View arg0, boolean arg1) {
            // TODO Auto-generated method stub
            arg0.setBackgroundColor(Color.YELLOW);
        }
});


I think, you are trying to create a hyperlink, if so, please refer to the following links;

  • http://www.indelible.org/ink/android-linkify/
  • Linkify in android TextView
  • http://developer.android.com/reference/android/text/util/Linkify.html
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜