J'essaie d'utiliser une superposition gestuelle sur une activité utilisée comme écran de démarrage.Superposition gestuelle sur SplashScreen
Le problème est lorsque I: gOverlay = (GestureOverlayView) this.findViewById(R.id.gOverlay);
, gOverlay est null.
Ceci est mon XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center" android:background="#000000"
android:weightSum="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.11">
<android.gesture.GestureOverlayView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/gOverlay"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:visibility="visible"
android:background="#000000"
>
</android.gesture.GestureOverlayView>
</RelativeLayout>
</LinearLayout>
Ce Splash est un code java:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
/** set time to splash out */
Bundle extras = getIntent().getExtras();
if (extras != null) {
Duration = extras.getString("Duration");
}
welcomeScreenDisplay = 4000;
try {
welcomeScreenDisplay = Integer.parseInt(Duration);
} catch (Exception x) {
}
gLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
if (!gLibrary.load()) {
finish();
}
gOverlay = (GestureOverlayView) this.findViewById(R.id.gOverlay);
gOverlay.setGestureVisible(false);
gOverlay.addOnGesturePerformedListener(this);
/** create a thread to show splash up to splash time */
Thread welcomeThread = new Thread() {
int wait = 0;
@Override
public void run() {
try {
super.run();
while (wait < welcomeScreenDisplay) {
sleep(100);
wait += 100;
}
} catch (Exception e) {
System.out.println("EXc=" + e);
} finally {
finish();
}
}
};
welcomeThread.start();
}
Ce que je suis en train de faire est: 1. Lorsque le bouton presse retour utilisateur écran Splash montrer. 2. Cet écran de démarrage sera sur l'écran pendant n secondes 3. Si l'utilisateur tire un « L » sur l'écran de démarrage, implicite superposition Gesture, l'activité principale sera .finish()
Merci
S'il vous plaît ajouter la source où vous attribuez 'gOverlay'. Etes-vous sûr, vous avez gonflé la bonne disposition? – AlbAtNf
Afficher le code où vous déclarez 'gOverlay' (si vous le faites). –
Ne pas faire d'écrans d'accueil. Vous perdez le temps de vos utilisateurs * chaque fois qu'ils démarrent votre application. Votre application n'en vaut probablement pas la peine. – 323go