activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:layoutDirection="ltr" 
    tools:context=".MainActivity"> 
 
 
    <RelativeLayout 
        android:id="@+id/relativeLayout1" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentTop="true" 
        android:background="#00ff00" 
        android:layout_centerHorizontal="true"> 
 
        <TextView 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Num 1:" 
            android:id="@+id/textView1" 
            android:layout_centerVertical="true" 
            android:layout_alignParentLeft="true" 
            android:layout_alignParentStart="true" /> 
 
        <EditText 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:inputType="numberSigned" 
            android:ems="10" 
            android:id="@+id/editText1" 
            android:layout_alignParentTop="true" 
            android:layout_toRightOf="@+id/textView1" 
            android:layout_toEndOf="@+id/textView1" /> 
    </RelativeLayout> 
 
    <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/relativeLayout1" 
        android:layout_marginTop="10dp" 
        android:background="#ffff00" 
        android:layout_centerHorizontal="true" 
        android:id="@+id/relativeLayout2"> 
 
        <TextView 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Num 1:" 
            android:id="@+id/textView2" 
            android:layout_centerVertical="true" 
            android:layout_alignParentLeft="true" 
            android:layout_alignParentStart="true" /> 
 
        <EditText 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:inputType="numberSigned" 
            android:ems="10" 
            android:id="@+id/editText2" 
            android:layout_alignParentTop="true" 
            android:layout_toRightOf="@+id/textView2" 
            android:layout_toEndOf="@+id/textView2" /> 
    </RelativeLayout> 
 
    <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="اعداد را جمع کن" 
        android:id="@+id/button" 
        android:onClick="add" 
        android:layout_below="@+id/relativeLayout2" 
        android:layout_centerHorizontal="true" 
        android:layout_marginTop="15dp" /> 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="جواب" 
        android:id="@+id/textView3" 
        android:layout_below="@+id/button" 
        android:layout_marginTop="15dp" 
        android:layout_centerHorizontal="true" /> 
 
</RelativeLayout>