Android计算器UI

Liunx | 2018-07-25 22:56:40 | 阅读 332 次 | 评论(0)
<?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:orientation="vertical"  android:layout_width="match_parent"  android:layout_height="match_parent">
 <LinearLayout  android:layout_width="match_parent"  android:layout_height="80dp"  android:orientation="horizontal">
 <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="C"  android:textSize="30sp"  android:background="@drawable/activity"/>
 <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="+/-"  android:textSize="30sp"  android:background="@drawable/activity"/>
 <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="%"  android:textSize="30sp"  android:background="@drawable/activity"/>
 <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="÷"  android:textSize="30sp"  android:background="@drawable/activity_layout"/>
</LinearLayout>
 <LinearLayout  android:layout_width="match_parent"  android:layout_height="80dp"  android:orientation="horizontal">
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="7"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="8"  android:textSize="30sp"  android:background="@drawable/activity" />
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="9"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="×"  android:textSize="30sp"  android:background="@drawable/activity_layout"/>
 </LinearLayout>
 <LinearLayout  android:layout_width="match_parent"  android:layout_height="80dp"  android:orientation="horizontal">
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="4"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="5"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="6"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="-"  android:textSize="30sp"  android:background="@drawable/activity_layout"/>
 </LinearLayout>
 <LinearLayout  android:layout_width="match_parent"  android:layout_height="80dp"  android:orientation="horizontal">
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="1"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="2"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="3"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <TextView  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="+"  android:textSize="30sp"  android:background="@drawable/activity_layout"/>
 </LinearLayout>
 <LinearLayout  android:layout_width="match_parent"  android:layout_height="80dp"  android:orientation="horizontal">
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="2"  android:gravity="center"  android:text="0"  android:paddingRight="90dp"  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="."  android:textSize="30sp"  android:background="@drawable/activity"/>
  <Button  android:layout_width="0dp"  android:layout_height="match_parent"  android:layout_weight="1"  android:gravity="center"  android:text="="  android:textSize="30sp"  android:background="@drawable/activity_layout"/>
  </LinearLayout>

</LinearLayout>


<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"  android:shape="rectangle">
    <solid android:color="#FF8E1D"/>
    <stroke  android:width="1dp"  android:color="#333333"/>
</shape>


文章评论,共0条
游客请输入验证码
最新评论