下面是布局源码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="103dp"
android:focusable="false"
android:gravity="right|center"
android:hint="@string/textview"
android:textSize="43sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="76dp"
android:orientation="horizontal">
<Button
android:id="@+id/buttonAC"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="AC"
android:textSize="24sp" />
<Button
android:id="@+id/buttonDEL"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="DEL"
android:textSize="24sp" />
<Button
android:id="@+id/buttonQY"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="%"
android:textSize="24sp" />
<Button
android:id="@+id/buttonCH"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="÷"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="76dp"
android:orientation="horizontal">
<Button
android:id="@+id/button7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="7"
android:textSize="24sp" />
<Button
android:id="@+id/button8"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="8"
android:textSize="24sp" />
<Button
android:id="@+id/button9"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="9"
android:textSize="24sp" />
<Button
android:id="@+id/buttonX"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="x"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="76dp"
android:orientation="horizontal">
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="4"
android:textSize="24