2012-05-30 12 views
1

在我notes_row.xml文件中的代碼看起來像使用android開發者示例'notepadv3' - 如何將「body」值添加到Listview?

<?xml version="1.0" encoding="utf-8"?> 
<TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:padding="10dp" 
android:minWidth="100dp"/> 
<TextView android:id="@+id/body" xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:padding="10dp" 
    android:minWidth="100dp" 
    android:fontSize="20dp"/> 

我收到以下錯誤 根元素下列文件中的標記必須得到很好的形成。 at線xmlns:android="http://schemas.android.com/apk/res/android"

我希望有人能夠幫助我找到成功。

注:我找到了我複製到此問題的代碼here

+0

你可以把它們放在單獨的XML文件。 – keyser

回答

0

我沒有測試,但嘗試這個辦法:

<?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"> 

    <TextView android:id="@+id/text1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:padding="10dp" 
     android:minWidth="100dp"/> 
    <TextView android:id="@+id/body" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:padding="10dp" 
     android:minWidth="100dp" 
     android:fontSize="20dp"/> 

</LinearLayout> 
+0

真棒!完美的工作......在我拿出android:fontSize =「20dp」之後 –

相關問題