1

I'm working on an very simple example i found on the internet , but my main.xml layout file isn't working.

When i add the body in main.xml , it can't display a thing.

Any help is appreciated :)

Here's the main.xml file.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"; android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> 
<EditText android:id="@+id/myEditText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/new_to_do_item" android:hint="@string/hint_msg" /> 
<ListView android:id="@+id/myListView" android:layout_width="fill_parent" android:layout_height="wrap_content" /> 
</LinearLayout>
Felix Christy
  • 2,179
  • 1
  • 19
  • 32
Tasos Moustakas
  • 308
  • 3
  • 12
  • 22
  • By the way , someone should improve the way someone posts a question.. Its so ugly and so misleading , the way the comments are posted! – Tasos Moustakas Jul 19 '12 at 11:17
  • Hi, dont blame SO for this, I have just copied your file content easily, so please remove your comment with the code – Felix Christy Jul 19 '12 at 11:19
  • Use the code markup button or the keyboard shortcut (`Ctrl+K`) to add code. Press the `?` button on the top right of the editor window to read formatting help. Don't blame Stack Overflow on your inability to use it. – Gilles 'SO- stop being evil' Jul 19 '12 at 11:24
  • 1. when i was posting the comment , it didnt display the contents of the .xml file on the preview display screen.. probably some loading problems. 2. Could someone help me how to post a code part correctly ?? I tried (Ctrl+K) but it doesnt help that much ... In fact , i was trying to post this comment for about 5'... – Tasos Moustakas Jul 19 '12 at 11:34

2 Answers2

1

Use <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

instead of

<LinearLayout xmlns:android="schemas.android.com/apk/res/android";

Try this...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/myEditText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="@string/hint_msg"
        android:text="@string/new_to_do_item" />

    <ListView
        android:id="@+id/myListView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

</LinearLayout>
Samir Mangroliya
  • 39,918
  • 16
  • 117
  • 134
  • Thats exactly my .xml file , samir .. But when i posted this question , it dissapeared .. Sorry but the code markup button isnt so helpful to me.. So , any other help would be appreciated :) – Tasos Moustakas Jul 19 '12 at 11:36
  • When i delete the body , it works just fine... thats a hint :P – Tasos Moustakas Jul 19 '12 at 11:57
  • Ok , found the real cause of the problem wrong Target API and a lot of nerves ( for some other reasons ) blurred me :) Sorry for wasting your time :) – Tasos Moustakas Jul 19 '12 at 12:04
0
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"; 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
>

to

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
>

works for me

Edit: to slow^^

Edit2:

To add something usefull: You have to tag XML or HTML markups as "Codesample", then they show up normally

Edit3:

Exception in loading layout: java.util.LinkedHashMap.eldest()Ljava/util/Map$Entry;

the first answer seems to have worked for some people

Community
  • 1
  • 1
billdoor
  • 1,999
  • 4
  • 28
  • 54