TextView with android:textIsSelectable=“true” not working in listview

不羁的心 提交于 2019-12-13 02:23:34

问题


I know it's similar to textview textIsSelectable="true" not working in Listview.

Everything is fine when TextView is along, copy, parse. But when it's in list's item. I long click in Textview, The copy and parse menu seems appeal in top(ActionBar), but it dismisses in half a second.

I guess, the ListView is pushed down, so it's recall getView(). Ok, It's my guess.

Can anyone helps me.

My English is poor. If it's unclear, forgive me....

Thanks

My getView:

            if (convertView == null) {
                convertView = getLayoutInflater().inflate(R.layout.item_list, parent, false);
            }
            TextView textView = (TextView) convertView;
            textView.setFocusable(true);
            textView.setFocusableInTouchMode(true);
            if (TextUtils.isEmpty(textView.getText())) {
                textView.setText("fdafdafdafkdsfjkldsfjioewjfiodsajlf" + position);
            }
            return convertView;

My item_list.xml:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
          android:padding="20dp"
          android:textIsSelectable="true"
          android:id="@+id/textView"
          android:layout_width="match_parent"
          android:layout_height="match_parent">

</TextView>

If it goes normal, the copy and parse menu comes:

But in ListView, the action bar menu pushed ListView down so ListView let this menu gone?

来源:https://stackoverflow.com/questions/32048983/textview-with-androidtextisselectable-true-not-working-in-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!