Android Question Displaying a result in an EditText view

johnaaronrose

Active Member
Licensed User
Longtime User
I display a result in an EditText, whose value I don't want to allow the user to change: I used EditText as I want the result to look better than a corresponding label but be obvious that it's the value corresponding to the Label. I've set it (by code using setFocusableInTouchMode command) to disallow focus on it as well as setting Enable=False (in the Designer).

However (though the user can't get focus on it or change its value, as I wanted), it looks bad i.e. it's in a shaded box with a white line through it. Is there any way that I can improve the look of the value?

If it's suggested that I replace the EditText by another view, is there any way to change a view to a different type i.e. without removing the EditText & adding the new view?
 

stevel05

Expert
Licensed User
Longtime User
If you just want a static background view, you can change the background of the edittext to any image, so you can find a suitable image and load it using setBackgroundImage. If you want it to be different when focused, clicked etc. (probably not in this case) then you can use a statelistdrawable to define a new look.
 
Upvote 0

johnaaronrose

Active Member
Licensed User
Longtime User
If you just want a static background view, you can change the background of the edittext to any image, so you can find a suitable image and load it using setBackgroundImage. If you want it to be different when focused, clicked etc. (probably not in this case) then you can use a statelistdrawable to define a new look.
Thanks, it worked as you said.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
No problem.

For completeness I should also have said that you can use a ninepatch image, either on it's own or as part of a statelistdrawable. Again, probably not necessary in this case if it's just a background for a one off image.
 
Upvote 0
Top