Android Question Custom EditText? (Border Color)

alexwekell

Member
Licensed User
Longtime User
On the left is what comes out by default when using edittext, but I would like the effect on the right. I couldn't find a thread with any info or a library for this, any help?
 

Attachments

  • edittext.jpg
    edittext.jpg
    54.2 KB · Views: 1,188

alexwekell

Member
Licensed User
Longtime User
Search the forum for the 9Patch tutorial, you will see how you can do it.

Managed to create it, but it's very blurry, any idea on how to fix it?
 

Attachments

  • Screenshot (01_36PM, Apr 24, 2014).png
    Screenshot (01_36PM, Apr 24, 2014).png
    109.5 KB · Views: 667
  • stock3.9.png
    stock3.9.png
    16.8 KB · Views: 575
Upvote 0

alexwekell

Member
Licensed User
Longtime User
There are online tools that can help with these image. Try this one: http://android-holo-colors.com/

Any reason why it can't seem to find my 9Patch files anymore?

B4X:
Public Sub AddToParent(Parent As Panel, Left As Int, Top As Int, Width As Int, height As Int, left2 As Int, top2 As Int, width2 As Int, height2 As Int)
    Parent.AddView(et, 50dip, -1dip, 265dip, 50dip)
    Parent.AddView(lv, left2, top2, width2, height2)
    SetNinePatchButton(et, "apptheme_textfield_default_holo_light", "apptheme_textfield_activated_holo_light")
End Sub

Sub SetNinePatchButton(Btn As EditText, DefaultImage As String, PressedImage As String)
  Dim r As Reflector
  Dim package As String
  Dim idDefault, idPressed As Int
  package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
  idDefault = r.GetStaticField(package & ".R$drawable", DefaultImage)
  idPressed = r.GetStaticField(package & ".R$drawable", PressedImage)
  r.Target = r.GetContext
  r.Target = r.RunMethod("getResources")
  Dim sd As StateListDrawable
  sd.Initialize
  sd.AddState(sd.State_Pressed, r.RunMethod2("getDrawable", idPressed, "java.lang.int"))
  sd.AddCatchAllState( r.RunMethod2("getDrawable", idDefault, "java.lang.int"))
  Btn.Background = sd
End Sub

Returns the error: LastException java.lang.NoSuchFieldException: apptheme_textfield_default_holo_light

I added all of my 9patch png files through the file browser
 
Upvote 0

alexwekell

Member
Licensed User
Longtime User
Put the 9patch files in Object/res/drawable and make them read-only. Clean project. Re-compile.

Crap, thanks, that worked, thought I am still wondering into the stretching problem with the 9patch files from the website above and I can't view my typed text.

Edit: NVM, fixed it by properly distributing drawables, I feel very stupid right now
 

Attachments

  • Screenshot (06_44PM, Apr 24, 2014).png
    Screenshot (06_44PM, Apr 24, 2014).png
    72.9 KB · Views: 571
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Very nice app.

A few observations:

1- You have a typo in the DISCLAIMER, you misspelled the word, you have "DISCLAMER"

2- In the disclaimer text you have misspelled the word COUNTRIES, you have "countires"

3- Replace the Toast "Please enter a country first" for a message box

4- Improve the voice search by accepting partial names, for example, I tried "United States" and nothing happened, but when I said "United States Of America" it found the entry, I say that because is going to be difficult for someone from Bosnia to get their country, unless someone knows how to spell the "&", also, display a "Country not found" message.

5- Add a WARNING that tapping on the number will actually CALL IMMEDIATELY and put the phone in "emergency call mode", you don't want some people "testing" your app calling 911 (or whatever the number is for the user's country).

6- It would be better if you could zoom the map to the current position, seeing the "world map" doesn't look right to me.

7- Fill the empty space on top of the screen (where the country name and flag is) if no country is selected, the app looks incomplete.

8- Change the hint color on the "name of the country" edit box, some people might find that hard to read.

9- On Google Play, you don't need this message: "This app requires Google Play Services in order to utilize the Google Maps API." that's only for developers.

Other than that, very nicely done, keep up the good work.
 
Last edited:
Upvote 0
Top