Solution 1 :
You could use a material card view (for better design) and have it look like a regular button but with EditText inside of it. you can enable or disable the edit text with the code.
<com.google.android.material.card.MaterialCardView android_layout_width="200dp" android_layout_height="100dp" android_elevation="8dp"> <com.google.android.material.textfield.TextInputEditText android_layout_width="match_parent" android_layout_height="match_parent" android_background="@null" android_cursorVisible="false" android_enabled="false" android_singleLine="true" android_text="THIS IS A BUTTON" android_textAlignment="center" android_textColor="@color/black" android_textStyle="bold" /> </com.google.android.material.card.MaterialCardView>
I have an app with multiple buttons, where I want the user to be able to long-press on any of them and be able to change the text inside.
I thought about bringing the user’s keyboard up when the long-press in registered, and then storing whatever they type in inside of a
text variable and then use
btn.setText(text) to update the button. However, I do not know how to prompt the user for input without having to resort to using a text field, which I would like to avoid as much as possible.
Is there a way to do this?
Comment posted by AAV
your question dose not clear can you give some code or image or explain?