Diana
Diana

Reputation: 57

Create an EditText on a Bitmap - Android programming

I wonder if it is possible to have an EditText on a Bitmap, in Android. I want that the user shall be able to enter some text in the EditText, which shall appear at the bottom of the screen, but also be able to see and click on the Bitmap. I saw similar questions, but I couldn't find any answer to them. Anyone solved this issue? Thanks, in advance.

Upvotes: 1

Views: 486

Answers (1)

David Manpearl
David Manpearl

Reputation: 12656

This can be achieved by putting both the ImageView (for your Bitmap) and the EditText into a RelativeLayout. The EditText should be placed on top. Use the EditText "visibility" property to hide it when not desired.

Example:

editText.setVisibility(EditText.INVISIBLE);

If you need to display the EditText alternatively at the bottom of the screen or within the Bitmap, then you should use two EditText objects and switch between them as necessary.

If you need to move the EditText that is overlaid on the ImageView/Bitmap, then use LayoutParameters to move the EditText.

Upvotes: 1

Related Questions