0

横向きのレイアウトを作成しようとしていますが、縦向きのレイアウトからコードをコピーすると、エラーが発生しました。

XMLの解析中にエラーが発生しました:オブジェクトが見つかりません。

このエラーは、以下のコードの最初の行に表示されます。

**?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:background="#8B4513"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/label1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="20dp"
        android:background="#2F4F4F"
        android:gravity="center"
        android:text="@string/rect"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#8B4513"
        android:orientation="horizontal" >
        <TextView
            android:id="@+id/label2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="50dp"
            android:background="#2F4F4F"
            android:gravity="center"
            android:text="@string/cm"
            android:textAppearance="?android:attr/textAppearanceMedium" />
        <EditText
            android:id="@+id/TextField1"
            android:layout_width="110dp"
            android:layout_height="21dp"
            android:layout_marginLeft="40dp"
            android:layout_marginTop="50dp"
            android:background="#2F4F4F"
            android:ems="10"
            android:gravity="center"
            android:inputType="text" />
   </LinearLayout>   
    </LinearLayout>**

助けてください

4

1 に答える 1

0

新しいレイアウトを作成し、これをコピーします。

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

    <TextView
        android:id="@+id/label1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="20dp"
        android:background="#2F4F4F"
        android:gravity="center"
        android:text="hello"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#8B4513"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/label2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="50dp"
            android:background="#2F4F4F"
            android:gravity="center"
            android:text="cm"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/TextField1"
            android:layout_width="110dp"
            android:layout_height="21dp"
            android:layout_marginLeft="40dp"
            android:layout_marginTop="50dp"
            android:background="#2F4F4F"
            android:ems="10"
            android:gravity="center"
            android:inputType="text" />
   </LinearLayout>   


</LinearLayout>
于 2013-02-06T18:10:30.547 に答える