aspose file tools*
The moose likes Android and the fly likes How to make TextVIew behave like EditText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to make TextVIew behave like EditText" Watch "How to make TextVIew behave like EditText" New topic
Author

How to make TextVIew behave like EditText

Amit Athavale
Greenhorn

Joined: Mar 31, 2003
Posts: 29
I am writing an application in which I want to make TextView editable. User should be able to tap on TextView and soft keyboard should show up and user should be able to write to TextView.
As one can see this is what we do with EditText. The deal is I want to have look and feel like a TextView and not EditView. Any idea how can I do this?

I set "Editable" attribute of TextView as true, but for sure that alone did not work.

All inputs appreciated.
Thanks!
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

EditText is an extension(subclass) of TextView. Android is open source. You can look at the source code for EditText and see for yourself how the guys at google manage to achieve that.


[List of FAQs] | [Android FAQ] | [Samuh Varta]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Part of the "feel" of a TextView is that it's a text VIEW and not an EDIT. So there's a bit of a conflict there.

You can use styles to customize the look of Android view items. Have you investigated that?


Customer surveys are for companies who didn't pay proper attention to begin with.
Amit Athavale
Greenhorn

Joined: Mar 31, 2003
Posts: 29
yes, I did. And I could make editText look like TextView which solves my problem.

k joshi
Greenhorn

Joined: Dec 29, 2009
Posts: 1
Hi Amit,

I have also encountered with same issue, please share code sample to make "TextView behave like EditText".

Thanks in Advance!
Amit Athavale
Greenhorn

Joined: Mar 31, 2003
Posts: 29
I made editText look like TextView by setting background color same as parent view's background color.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to make TextVIew behave like EditText