实现一个加减按钮,就简单的实现了一个带加减按钮的小功能
首先看下这个布局
?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="90dp"
android:layout_height="30dp"
android:focusable="true"
android:divider="@drawable/divider"
android:dividerPadding="5dp"
android:background="@drawable/bg_amount_layout"
android:showDividers="middle"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/btnDecrease"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<TextView
android:id="@+id/btnDecrease_icon"
android:layout_width="17dp"
android:layout_height="17dp"
android:gravity="center"
android:layout_centerInParent="true"
android:background="@drawable/reduce_nor"/>
</RelativeLayout>
<TextView