File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make TextVIew behave like EditText

 
Amit Athavale
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1369
1
Android Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Amit Athavale
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I did. And I could make editText look like TextView which solves my problem.

 
k joshi
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic