アイテムのバリエーションに3つのチェックボックスを使用し、価格に3つのテキストビューを使用するプログラムを作成しています。ユーザーがチェックボックス1をクリックすると、価格がtextview1に表示され、2番目のように次のアクティビティに送信されます。選択したアクティビティ:checkbox1 $ 2.00、注文に追加するための画像ボタンを使用してこれを実行したいので、簡単なコードを書いてください。ここにmain.xmlコードを配置しています:-
<TextView
android:id="@+id/regular"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/var1"
android:layout_marginLeft="40dp"
android:text="$2.00"
android:textColor="#343434"
android:textSize="15dip" />
<CheckBox
android:id="@+id/var2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cost"
android:layout_toRightOf="@+id/var1"
android:text="Small" />
<TextView
android:id="@+id/small"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/var2"
android:layout_toRightOf="@+id/var1"
android:layout_marginLeft="40dp"
android:text="$1.00"
android:textColor="#343434"
android:textSize="15dip" />
<CheckBox
android:id="@+id/var3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cost"
android:layout_toRightOf="@+id/var2"
android:text="Large" />
<TextView
android:id="@+id/large"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/var3"
android:layout_toRightOf="@+id/var2"
android:layout_marginLeft="40dp"
android:text="$3.00"
android:textColor="#343434"
android:textSize="15dip" />
<ImageButton
android:id="@+id/add_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/add_order" />