Ich möchte, dass meine Bildschaltflächen oben auf dem Bildschirm beginnen und das Ende des Bildschirms erreichen, gefolgt von einem weiteren Bildknopf dahinter, und dies geht für immer wie weiße Streifen auf einer Straße weiter. Wenn ein Knopf das Ende des Bildschirms erreicht, muss der Teil, der nicht sichtbar ist, oben auf dem Bildschirm sichtbar sein und dies sollte für jeden Knopf gelten.Wie kontinuierliche Animation in Android zu tun?
Siehe das Bild für die letzte Bild-Taste für klare Sicht. Diese
ist der Code für meine XML-Datei
<?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:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.ash432.itguesses.options"
android:background="#040404">
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im1"
android:layout_marginLeft="29dp"
android:layout_marginStart="29dp"
android:background="#f9f6f6"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layoutAnimation="@anim/layout_anim"
/>
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im2"
android:background="#f9f6f6"
android:layout_marginTop="26dp"
android:layout_below="@+id/im1"
android:layout_alignLeft="@+id/im1"
android:layout_alignStart="@+id/im1" />
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im3"
android:background="#f9f6f6"
android:layout_marginTop="26dp"
android:layout_below="@+id/im2"
android:layout_alignLeft="@+id/im2"
android:layout_alignStart="@+id/im2" />
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im4"
android:background="#ffffff"
android:layout_marginTop="26dp"
android:layout_below="@+id/im3"
android:layout_alignLeft="@+id/im3"
android:layout_alignStart="@+id/im3" />
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im5"
android:background="#ffffff"
android:layout_marginTop="26dp"
android:layout_below="@+id/im4"
android:layout_alignLeft="@+id/im4"
android:layout_alignStart="@+id/im4" />
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im6"
android:background="#ffffff"
android:layout_marginTop="26dp"
android:layout_below="@+id/im5"
android:layout_alignLeft="@+id/im5"
android:layout_alignStart="@+id/im5" />
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im7"
android:background="#ffffff"
android:layout_marginTop="26dp"
android:layout_below="@+id/im6"
android:layout_alignLeft="@+id/im6"
android:layout_alignStart="@+id/im6" />
<ImageButton
android:layout_width="5dp"
android:layout_height="40dp"
android:id="@+id/im8"
android:background="#ffffff"
android:layout_marginTop="26dp"
android:layout_below="@+id/im7"
android:layout_alignLeft="@+id/im7"
android:layout_alignStart="@+id/im7" />
Und hier ist der Java-Code
public class options extends AppCompatActivity
{
private ImageButton im1,im2,im3,im4,im5,im6,im7,im8;
private Animation mAnimation;
//private Button b;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_options);
im1 = (ImageButton)findViewById(R.id.im1);
im2 = (ImageButton)findViewById(R.id.im2);
im3 = (ImageButton)findViewById(R.id.im3);
im4 = (ImageButton)findViewById(R.id.im4);
im5 = (ImageButton)findViewById(R.id.im5);
im6 = (ImageButton)findViewById(R.id.im6);
im7 = (ImageButton)findViewById(R.id.im7);
im8 = (ImageButton)findViewById(R.id.im8);
mAnimation = new TranslateAnimation(
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
TranslateAnimation.RELATIVE_TO_PARENT, 1.0f);
mAnimation.setDuration(2000);
mAnimation.setRepeatCount(-1);
mAnimation.setRepeatMode(Animation.INFINITE);
mAnimation.setInterpolator(new LinearInterpolator());
mAnimation.getStartTime();
im1.setAnimation(mAnimation);
im2.setAnimation(mAnimation);
im3.setAnimation(mAnimation);
im4.setAnimation(mAnimation);
im5.setAnimation(mAnimation);
im6.setAnimation(mAnimation);
im7.setAnimation(mAnimation);
im8.setAnimation(mAnimation);
}
}
UPDATE-
Für diejenigen, die die Frage nicht richtig verstehen können.
1) Zuerst möchte ich nichts auf dem Bildschirm nur den Hintergrund.
2) Dann sollte nach einiger Zeit ein weißer Streifen von der Oberseite des Bildschirms kommen.
3) Dann ist es soweit, dass nach einiger Zeit ein zweiter weißer Streifen zu sehen ist.
4) Gleiches Verfahren für alle Acht Bildtasten.
5) Jetzt, wenn die erste Bildschaltfläche den unteren Bildschirmrand erreicht. Seine Größe sollte abnehmen, während am oberen Bildschirmrand die Größe zunehmen sollte. Ähnlich für alle Tasten, wenn sie erreichen den unteren Rand des Bildschirms
6) Der Abstand zwischen den Streifen konstant sollte sein.
Hier ist das Bild zeigt die Schritten-
Ich hoffe, ich habe meine Frage klar.
Eigentlich bin ich neu in Android. Also weiß ich nicht, wie man Adapter- und Recycler-Ansicht benutzt. Könnten Sie bitte ausführlich ausarbeiten ?? – Ash
@Ash überprüfen Sie meine Bearbeitung. –
Ich hatte Schwierigkeiten bei der Implementierung der Adapter- und Recycler-Ansicht. Auch mein Android Studio unterstützt Recycler View nicht. Könnten Sie mir einen anderen Weg vorschlagen? Lies auch mein UPDATE, wenn du meine Frage nicht verstanden hast. – Ash