写得比较粗糙,请见谅。
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*" >
<EditText
android:layout_weight="1"
android:gravity="rightcenter_vertical"
android:background="#f0f0f0"
android:id="@+id/input"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:editable="false"
android:textSize="30dp"
/>
<TableRow
android:layout_weight="1"
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/7hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="7" />
<Button
android:id="@+id/8hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="8" />
<Button
android:id="@+id/9hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="9" />
<Button
android:id="@+id/chu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="/" />
</TableRow>
<TableRow
android:layout_weight="1"
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/4hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="4" />
<Button
android:id="@+id/5hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="5" />
<Button
android:id="@+id/6hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="6" />
<Button
android:id="@+id/cheng"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="*" />
</TableRow>
<TableRow
android:layout_weight="1"
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/1hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="1" />
<Button
android:id="@+id/2hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="2" />
<Button
android:id="@+id/3hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="3" />
<Button
android:id="@+id/jian"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="—" />
</TableRow>
<TableRow
android:layout_weight="1"
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/xiaoshudian"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="." />
<Button
android:id="@+id/0hao"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="0" />
<Button
android:id="@+id/jia"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="+" />
<Button
android:id="@+id/del"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="DEL"
/>
</TableRow>
<TableRow
android:layout_weight="1"
android:id="@+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/dengyu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="="
android:background="#FF6100"
android:layout_span="3"/>
<Button
android:id="@+id/clear"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="CLEAR" />
</TableRow>
</TableLayout>```
點(diǎn)擊查看更多內(nèi)容
6人點(diǎn)贊
評(píng)論
評(píng)論
共同學(xué)習(xí),寫下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦