0

Date と Time の 2 つのボタンを使用しています。うまく機能しています。しかし、ボタン Clear をさらに追加する必要があります。クリアボタンをクリックすると、日付と時刻のボタンが空になります(日付と時刻は表示されません)。

<Button
    android:id="@+id/btn_qs_date"
    style="@style/Text.Medium"
    android:layout_width="wrap_content"
    android:layout_height="40dp"
    android:text="Thu, 15/03/2012" />

<Button
    android:id="@+id/btn_qs_time"
    style="@style/Text.Medium"
    android:layout_width="wrap_content"
    android:layout_height="40dp"
    android:layout_marginLeft="10dp"
    android:text="11:00 AM" />

<ImageButton 
    android:id="@+id/reset_date_time"
    android:layout_width="30dp"
    android:layout_height="30dp"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center"
    android:layout_marginLeft="20dp"
    android:background="@drawable/selector_reset_button" />

そして私のJavaコードは次のとおりです:-

case R.id.btn_reset_radio_test_grp:

    rgYes.setChecked(false);
    rgNo.setChecked(false);
    break;

case R.id.reset_date_time:

    //i will have to write here
break;
4

1 に答える 1

0
clearButton.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    btn_qs_date.setText("");
                    btn_qs_time.setText("");
                }
            });

clearButton はclearButtonUI のどこにありますか

于 2012-06-15T04:23:18.850 に答える