开发者

how to get focus in underlined textview text android

开发者 https://www.devze.com 2023-03-24 06:52 出处:网络
i havecreated a textview with underline text like this <TextView android:id=\"@+id/label\" android:layout_width=\"wrap_content\"

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

精彩评论

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