Problem with EditText


Last Updated:

  1. Fischer

    Fischer New Member This Topic's Starter

    Joined:
    Mar 1, 2011
    Messages:
    1
    Likes Received:
    0
    Hello everybody I am now beginning to tinker with Android, and I have a problem that is much more simple could not understand why this happening, so come to this problem: The thing is I'm trying to create a text field, but what happens is that I can not visualize it in the emulator and did not understand why because I think it has nothing wrong.

    I will show you the code below:
    main.xml

    Code (Text):
    1. [FONT=monospace][COLOR=#009900][COLOR=#3F7F7F]<?xml[/COLOR] [COLOR=#7F007F]version[/COLOR]=[COLOR=#2A00FF]"1.0"[/COLOR] [COLOR=#7F007F]encoding[/COLOR]=[COLOR=#2A00FF]"UTF-8"[/COLOR][COLOR=#ddbb00]?>[/COLOR][/COLOR]
    2. [COLOR=#009900][COLOR=#3F7F7F]<LinearLayout[/COLOR] [COLOR=#7F007F]xmlns:android[/COLOR]=[COLOR=#2A00FF]"http://schemas.android.com/apk/res/android"[/COLOR]
    3.     [COLOR=#7F007F]android:orientation[/COLOR]=[COLOR=#2A00FF]"vertical"[/COLOR]
    4.     [COLOR=#7F007F]android:layout_width[/COLOR]=[COLOR=#2A00FF]"fill_parent"[/COLOR]
    5.     [COLOR=#7F007F]android:layout_height[/COLOR]=[COLOR=#2A00FF]"fill_parent"[/COLOR][COLOR=#ddbb00]>[/COLOR][/COLOR]"
    6.  
    7.     [COLOR=#009900][COLOR=#3F7F7F]<EditText[/COLOR]
    8.     [COLOR=#7F007F]android:layout_width[/COLOR]=[COLOR=#2A00FF]"fill_parent"[/COLOR]
    9.     [COLOR=#7F007F]android:layout_height[/COLOR]=[COLOR=#2A00FF]"wrap_content"[/COLOR]
    10.     [COLOR=#7F007F]android:hint[/COLOR]=[COLOR=#2A00FF]"@string/cptext"[/COLOR][COLOR=#ddbb00]/>[/COLOR][/COLOR]
    11. [COLOR=#009900][COLOR=#3F7F7F]</LinearLayout[COLOR=#ddbb00]>[/COLOR][/COLOR][/COLOR][/FONT]
    12.  
    13.  
    strings.xml

    Code (Text):
    1. [FONT=monospace][COLOR=#009900][COLOR=#3F7F7F]<?xml[/COLOR] [COLOR=#7F007F]version[/COLOR]=[COLOR=#2A00FF]"1.0"[/COLOR] [COLOR=#7F007F]encoding[/COLOR]=[COLOR=#2A00FF]"UTF-8"[/COLOR][COLOR=#ddbb00]?>[/COLOR][/COLOR]
    2. [COLOR=#009900][COLOR=#3F7F7F]<resources[COLOR=#ddbb00]>[/COLOR][/COLOR][/COLOR]
    3.     [COLOR=#009900][COLOR=#3F7F7F]<string[/COLOR] [COLOR=#7F007F]name[/COLOR]=[COLOR=#2A00FF]"app_name"[/COLOR][COLOR=#ddbb00]>[/COLOR][/COLOR]HelloAndroid[COLOR=#009900][COLOR=#3F7F7F]</string[COLOR=#ddbb00]>[/COLOR][/COLOR][/COLOR]
    4.     [COLOR=#009900][COLOR=#3F7F7F]<string[/COLOR] [COLOR=#7F007F]name[/COLOR]=[COLOR=#2A00FF]"cptexto"[/COLOR][COLOR=#ddbb00]>[/COLOR][/COLOR]Digite o Texto[COLOR=#009900][COLOR=#3F7F7F]</string[COLOR=#ddbb00]>[/COLOR][/COLOR][/COLOR]
    5. [COLOR=#009900][COLOR=#3F7F7F]</resources[COLOR=#ddbb00]>[/COLOR][/COLOR][/COLOR][/FONT]
    6.  
    7.  
    I hope you can help me. I await answers.
     

    Advertisement
  2. JamTheMan

    JamTheMan Well-Known Member

    Joined:
    Dec 16, 2010
    Messages:
    136
    Likes Received:
    21
    If that is code snapped directly from your code, you are either missing an "o" or having an unwanted "o" in the string resource named cptext(o)...
     
  3. scrapperstoo

    scrapperstoo Member

    Joined:
    Dec 6, 2010
    Messages:
    9
    Likes Received:
    0
    Also, I think
    Code (Text):
    1. android:hint="@string/cptext"
    should probably be
    Code (Text):
    1. android:[COLOR="Red"]text[/COLOR]="@string/cptext"
     

Share This Page

Loading...