1. Download our Official Android App: Forums for Android!

Apps Problem with EditText

Discussion in 'Android Development' started by Fischer, Mar 1, 2011.

  1. Fischer

    Fischer Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Mar 1, 2011

    Mar 1, 2011
    1
    0
    5
    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
    Rank:
    None
    Points:
    38
    Posts:
    136
    Joined:
    Dec 16, 2010

    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 Lurker
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Dec 6, 2010

    Dec 6, 2010
    9
    0
    5
    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...