baTimá
baTimá

Reputation: 544

App Force Close after editing XML Layout

I have 2 buttons and 2 textviews (1button and 1textview in one line, samething in the line below it) then i try to make all of them in the same line but when i run the app it forces to close. XML Layout code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:ignore="HardcodedText" >

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="22dp"
    android:layout_marginTop="46dp"
    android:text="Mensagem:" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="Destinatario:"
    android:textSize="22dp" />

<Spinner
    android:id="@+id/spinner1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true" />

<EditText
    android:id="@+id/etMsg"
    android:layout_width="fill_parent"
    android:layout_height="150dp"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/textView2"
    android:ems="10"
    android:inputType="textMultiLine" />

<Button
    android:id="@+id/bEnviar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:text="ENVIAR" />

<Button
    android:id="@+id/bData"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/etMsg"
    android:layout_marginTop="66dp"
    android:text="Data" />

<TextView
    android:id="@+id/tvData"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/bData"
    android:layout_alignBottom="@+id/bData"
    android:layout_alignRight="@+id/textView1"
    android:text="data" />

<Button
    android:id="@+id/bHora"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tvData"
    android:layout_alignBottom="@+id/tvData"
    android:layout_marginRight="24dp"
    android:layout_toLeftOf="@+id/spinner1"
    android:text="Hora" />

<TextView
    android:id="@+id/tvHora"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/bHora"
    android:layout_alignBottom="@+id/bHora"
    android:layout_alignLeft="@+id/spinner1"
    android:text="hora" />

Upvotes: 0

Views: 443

Answers (1)

Ridcully
Ridcully

Reputation: 23665

Sometimes, when you change something in a Layout, the generated R class is not updated correctly. This has caused the described errors several time for me. Try to clean your project so everything is compiled/generated anew, and hopefully the error goes away.

Upvotes: 3

Related Questions