Android Question [SOLVED]How to make label Selectable ?

nanjidusan

Member
Licensed User
I want to select label's content , and can copy it to clipboard . Is there a solution?
copy.png
 
Last edited:

nanjidusan

Member
Licensed User
put the labels text on a Editfield. Here you then can copy it.

Alternatively you can use the click event of the label and then you copy the labels text to clipboard.
Thanks . I am a beginner , I try it many times , and don't solve it . Can you give me a code example ?
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Use EditText by disabling the keyboard. Indicating insertion method none.
 
Upvote 0

nanjidusan

Member
Licensed User
Nice ! I made it ! I use Erel's XmlLayoutBuilder to solved the problem successfully ! Thank Erel ! I make a label electable !
This is my code .
B4X:
<TextView
   android:id="@+id/label"
   android:layout_width="match_parent" android:layout_height="wrap_content"
   android:paddingBottom="4dip"
   android:textAppearance="?android:attr/textAppearanceMedium"
   android:textIsSelectable="true"/>


Dim x As XmlLayoutBuilder
x.LoadXmlLayout(Activity, "layout1")
label1=x.GetView("label")
label1.Text="Can you copy?"
 
Last edited:
Upvote 0
Top