Ich habe eine Splash-Aktivität, die ich 3 Bilder im Folienmodus auf jeder 2 Sekunden anzeigen möchte, und ich möchte Skip-Schaltfläche in Splash-Bildschirm hinzufügen, aber es funktioniert nicht.3 Splash in einer Aktivität und die Schaltfläche funktioniert nicht
hier ist mein splash.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="bottom|right"
android:background="#000000">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_weight="1.0"
android:gravity="center">
<Button
android:id="@+id/slidesplash"
android:layout_height="240dp"
android:layout_width="240dp"
android:maxHeight="360dp"
android:maxWidth="360dp"
android:minWidth="120dp"
android:minHeight="120dp"
android:layout_marginTop="30dp"
android:text="how can i change the background of this button in each 2 seconds?"/>
</LinearLayout>
<Button
android:id="@+id/splashskip"
android:layout_height="60dp"
android:layout_width="60dp"
android:background="@drawable/splashskip"/>
</LinearLayout>
hier mein splash.java ist
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Menu;
import android.widget.TextView;
public class Splash extends Activity {
Button Button;
// Splash screen timer
private static int SPLASH_TIME_OUT = 6000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
getActionBar().hide();
new Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo/company
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(Splash.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
public void addListenerOnButton() {
final Context context = this;
button = (Button) findViewById(R.id.splashskip);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(context, MainActivity.class);
startActivity(intent);
}
});
}}
hier ist das Bild von splash
können Sie bitte den vollständigen Fehler-Stack schreiben? – Chisko
Ich benutze AIDE der einzige Fehler ist die Angabe dieser zwei Zeile –