In android StudioKnopfschalter in der Laufzeit
Ich habe 3 Tasten. Ich möchte, dass ein Knopf für einige Sekunden aktiv ist, während die anderen beiden inaktiv sind und der zufällige Knopf für einige Sekunden aktiviert werden soll. Die Schaltzeit sollte sich allmählich verringern. Der gesamte Prozess dauert 2 Minuten.
Die aktive Schaltfläche sollte eine bestimmte Farbe erhalten.
Ich scheint nicht die Logik zu bekommen. Wenn ich den Code dafür bekomme, werde ich glücklich sein.
ich habe das grundlegende Layout! Die MainActivity ist die Standardumgebung! Danke.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.android.courtcounter.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:layout_marginTop="36dp"
android:id="@+id/Score"
tools:text="0"
android:minHeight="52dp"
android:minWidth="52dp"
android:textSize="36sp"
tools:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
tools:textAlignment="center" />
<Button
android:text="3 Point"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="110dp"
android:id="@+id/button"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:elevation="14dp"
android:background="#ff0000"/>
<Button
android:text="2 Point"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button2"
android:layout_below="@+id/button"
android:layout_alignLeft="@+id/button"
android:layout_alignStart="@+id/button"
android:layout_marginTop="32dp" />
<Button
android:text="Free Throw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="27dp"
android:id="@+id/button3"
android:layout_below="@+id/button2"
android:layout_centerHorizontal="true" />
</RelativeLayout>