C
Christian Z.
Neues Mitglied
- 0
Hallo
ich bin gerade dabei ein Menü zu erstellen, bei dem ein Button (nachdem er geklickt wurde) aus dem Bild "rausfahren" soll. D.h. seine größe wird immer kleiner bis sie 0 ist. Bei 2 von 3 Buttons klappt das auch. Beim ersten Button allerdings nicht. Ich verstehe nur nicht warum.
ich bin gerade dabei ein Menü zu erstellen, bei dem ein Button (nachdem er geklickt wurde) aus dem Bild "rausfahren" soll. D.h. seine größe wird immer kleiner bis sie 0 ist. Bei 2 von 3 Buttons klappt das auch. Beim ersten Button allerdings nicht. Ich verstehe nur nicht warum.
Code:
<Button
android:id="@+id/mainbildschirm_LosGehts"
android:layout_width="274dp"
android:layout_height="50dp"
android:layout_gravity="right|top"
android:layout_marginTop="28dp"
android:background="@drawable/hintergrund_startbutton_1"
android:fitsSystemWindows="false"
android:gravity="left"
android:textColor="@color/schwarz"
android:textSize="22sp" />
<Button
android:id="@+id/mainbildschirm_HighScore"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="right|center_vertical"
android:layout_marginBottom="15dp"
android:background="@color/Rot"
android:gravity="left"
android:text="Highscore"
android:textColor="@color/schwarz"
android:textSize="22sp" />
<Button
android:id="@+id/mainbildschirm_Credits"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="bottom|right"
android:layout_marginBottom="70dp"
android:background="@android:color/transparent"
android:gravity="left"
android:text="Credits"
android:textColor="@color/schwarz"
android:textSize="22sp" />
Code:
private void Fahren() {
if (INTWhichButton == 1) {
// but1.width = INTbutton1Width -3;
button1.setWidth(button1.getWidth() - 3);
INThandlerzahl = 1;
if (button1.getWidth() <= 0) {
mp.pause();
Intent Game = new Intent(this, GameActivity.class);
Game.putExtra("showTrailer", BOOLshowTrailer);
startActivityForResult(Game, INTGame_ID);
} else {
handler.postDelayed(this, 50);
}
} else if (INTWhichButton == 2) {
button2.setWidth(button2.getWidth() - 3);
INThandlerzahl = 1;
if (button2.getWidth() <= 0) {
mp.pause();
Intent HighScore = new Intent(this, Highscore.class);
HighScore.putExtra("showTrailer", BOOLshowTrailer);
startActivityForResult(HighScore, INTHighScore_ID);
} else {
handler.postDelayed(this, 50);
}
} else if (INTWhichButton == 3) {
button3.setWidth(button3.getWidth() - 3);
INThandlerzahl = 1;
if (button3.getWidth() <= 0) {
mp.pause();
Intent Credits = new Intent(this, Credits.class);
Credits.putExtra("showTrailer", BOOLshowTrailer);
startActivityForResult(Credits, INTCredits_ID);
} else {
handler.postDelayed(this, 50);
}
}
}