用Eslipse开发Android案例(1)——计算器<part2>

来源:互联网 发布:java 时间格式 编辑:程序博客网 时间:2024/06/05 19:35
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/LinearLayout1"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical" >    <EditText        android:id="@+id/text"        android:layout_width="fill_parent"        android:layout_height="wrap_content" />    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content" >        <Button            android:id="@+id/seven"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="7"            android:layout_weight="1" />        <Button            android:id="@+id/eight"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="8"             android:layout_weight="1"/>        <Button            android:id="@+id/nine"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="9"            android:layout_weight="1" />        <Button            android:id="@+id/除号"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="/"             android:layout_weight="1"/>    </LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content" >        <Button            android:id="@+id/four"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="4"            android:layout_weight="1" />        <Button            android:id="@+id/five"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="5"             android:layout_weight="1"/>        <Button            android:id="@+id/six"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="6"             android:layout_weight="1"/>        <Button            android:id="@+id/乘号"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="*"             android:layout_weight="1"/>    </LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content" >        <Button            android:id="@+id/one"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="1"             android:layout_weight="1"/>        <Button            android:id="@+id/two"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="2"             android:layout_weight="1"/>        <Button            android:id="@+id/three"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="3"             android:layout_weight="1"/>        <Button            android:id="@+id/减号"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="-"             android:layout_weight="1"/>    </LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content" >        <Button            android:id="@+id/point"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="."            android:layout_weight="1" />        <Button            android:id="@+id/zero"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="0"            android:layout_weight="1" />        <Button            android:id="@+id/删除"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="←"             android:layout_weight="1"/>        <Button            android:id="@+id/plus"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="+"             android:layout_weight="1"/>    </LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content" >        <Button            android:id="@+id/equal"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="0.75"            android:text="=" />    </LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content" >        <Button            android:id="@+id/clear"            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:text="" />    </LinearLayout></LinearLayout>

效果图这里写图片描述

可能出现的问题
meau功能

http://stackoverflow.com/questions/27514540/android-development-getmenuinflaterr-menu-main-menu

id问题

需要再创建一个文件夹
id问题对应解释

0 0