如何使 android:文本可选=“真实” 与我的意图一起工作?

我在使可编辑时遇到问题 - 虽然我可以使其可编辑,但我无法通过 .textviewintent


在我的活动中,对于我的文本框,我有:xmlViewtextViewComment


<TextView

android:id="@+id/textViewComment"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_weight="1"

android:background="@drawable/textboxes_for_contact"

android:textIsSelectable="true"

中的文本确实是可选的,我可以通过长按复制它。textbox


但是,我有一个活动 - 当在活动中单击编辑按钮时,中的文本应使用 .相反,我的是空的。EditViewtextViewCommentEditintentEdittextEditView


当我删除文本时,通过意图成功传递。但。。。我无法在 .android:textIsSelectable="true"textview


我也以编程方式尝试过,但这给出了同样的问题。commentname.setTextIsSelectable(true);


在课堂上我有ViewContact


i.putExtra("comment", commentname.getText());

在课堂上:EditContact


comment = i.getStringExtra("comment");

在我的班级里是:xmlEditContacttextViewComment


        <EditText

            android:id="@+id/textViewComment"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:inputType="textCapSentences"

            android:background="@drawable/textboxes_for_contact"

            android:maxLength="360"

            />

任何想法,我如何使文本可选,同时也成功通过?这是一个已知问题吗?ViewContactintent


繁星点点滴滴
浏览 59回答 1
1回答

绝地无双

取代:&nbsp;i.putExtra("comment",&nbsp;commentname.getText());跟:&nbsp;i.putExtra("comment",&nbsp;commentname.getText().toString());看看你是否有更好的运气。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java