プログラミング初心者です。
12hと24Hの時計をTextClockで表示するレイアウトを作成したのですが、
ボタンを押すと(画面遷移はせずに)12Hと24Hが切り替わるようにしたいです。
どのような実装をすればよいかわかりません。よろしくお願いします。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/blue">
<TextView android:id="@+id/TextView01" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:layout_marginTop="10dp" android:textColor="#000000" android:textSize="20dp" /> <TextClock android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:layout_marginTop="10dp" android:textSize="50dp" android:textColor="#ff00ff" android:format12Hour="kk:mm:ss"
<TextClock android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:layout_marginTop="10dp" android:textSize="50dp" android:textColor="#ff00ff" android:format24Hour="a hh:mm:ss"/>
</LinearLayout><Button android:id="@+id/tH" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_weight="1" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="12H" android:onClick="onButtonClick" android:textSize="16sp" />
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/02 12:32