
1. activity.xml文件中代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".jisuanqiActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:background="@drawable/shape"
android:text="C" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="+/-" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="%" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:background="@drawable/shape_ring"
android:text="/" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:background="@drawable/shape"
android:text="1" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="2" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="3" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:background="@drawable/shape_ring"
android:text="×" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="4" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="5" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="6" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:background="@drawable/shape_ring"
android:text="-" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="7" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="8" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="9" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:background="@drawable/shape_ring"
android:text="+" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="2"
android:textSize="30sp"
android:gravity="center"
android:text="0" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/shape"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:text="·" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="30sp"
android:gravity="center"
android:background="@drawable/shape_ring"
android:text="=" />
</LinearLayout>
</LinearLayout>
2.drawable下面shape.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1dp"/>
<solid android:color="#ffffff"/>
<stroke
android:width="2dp"
android:color="#333333"/>
<!-- <padding
android:bottom="5dp"
android:left="10dp"
android:right="10dp"
android:top="5dp"/>-->
</shape>
3.drawable下面shape_ring.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1dp"/>
<solid android:color="#e47f26"/>
<stroke
android:width="2dp"
android:color="#333333"/>
<!-- <padding
android:bottom="5dp"
android:left="10dp"
android:right="10dp"
android:top="5dp"-->/>
</shape>
博客展示了Android布局相关的XML代码,包括activity.xml文件中的代码,以及drawable目录下shape.xml和shape_ring.xml的代码,聚焦于Android布局方面的信息技术内容。
1万+

被折叠的 条评论
为什么被折叠?



