本篇实现一个简单的综合小练习,主要涉及,鼠标单击、事件侦听、单选等,主要是想练习如何获取对应消息并显示出来。
实现如下图所示UI界面,当点击按钮后,“类别”和“金额”分别显示所选择和输入的内容。
Layout中:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/tv_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_marginTop="10dp"