why item not clickable when contains web links(android:autolink="web"). how make worked , links, , selects item in list? tried set property in root element "android:descendantfocusability="blocksdescendants", did not when clicked 1 item not selected, open link. when clicked 2 item selected. thx. please sorry english xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="3dp"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/items_selector" android:descendantfocusability="beforedescendants" android:orientation="vertical" android:padding="2dp"> <textview android:id="@+id/messagetext" android:layout_width="match_parent" android:layout_height="wrap_content" android:autolink="web" android:padding="@dimen/layout_margin" android:text="Сообщение"/> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#f5f5f5" android:descendantfocusability="afterdescendants" android:orientation="horizontal" android:paddingbottom="5dp" android:paddingleft="5dp" android:paddingright="5dp"> <linearlayout android:id="@+id/info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <textview android:id="@+id/usernick" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:text="goest" android:textsize="12sp" android:textstyle="bold"/> <textview android:id="@+id/messagedate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="5dp" android:layout_torightof="@id/usernick" android:text="57 мин. назад" android:textsize="12sp"/> </linearlayout> <linearlayout android:id="@+id/ratinglayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_marginleft="10dp" android:layout_torightof="@id/info" android:gravity="center" android:orientation="horizontal"> <imageview android:id="@+id/like" android:layout_width="12dp" android:layout_height="12dp" android:background="@drawable/like" android:clickable="true"/> <textview android:id="@+id/likecount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginright="5dp" android:textsize="12sp"/> <imageview android:id="@+id/dislike" android:layout_width="12dp" android:layout_height="12dp" android:background="@drawable/dislike" android:clickable="true"/> <textview android:id="@+id/dislikecount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="12sp"/> </linearlayout> </relativelayout> </linearlayout> </linearlayout>
there 2 possible solutions. first of all, use autolink flag in textview:
android:autolink="web"
the other way use setmovementmethod on textview programatically:
textview.setmovementmethod(linkmovementmethod.getinstance());
i hope works you.
Comments
Post a Comment