2017-06-09 1 views
0

J'utilise cette méthode populaire de ce site pour faire un écran de démarrage: Splash Screens the Right Way.Inclure le texte sur l'écran de démarrage Android

Et je veux afficher un texte traduit "chargement" à différentes langues. Cela a été demandé plus tôt dans la section des commentaires, et l'auteur a répondu, mais je ne sais pas comment faire ce qu'il dit. Voici ce qu'il a répondu: https://www.bignerdranch.com/blog/splash-screens-the-right-way/#comment-2633426495

Comment puis-je dessiner le texte à l'écran? (Si c'est possible) Ou comme il est dit ici, Comment "l'inclure" dans le dessinable?

Une autre méthode est-elle préférable?

+0

son simple..just créer une mise en page avec ou linéaire relative .. mis ImageView et TextView à l'intérieur .. – ZeroOne

+0

Bienvenue sur SO. S'il vous plaît lire ceci [how-to-answer] (http://stackoverflow.com/help/how-to-answer) et suivez les directives pour fournir une réponse de qualité. – thewaywewere

Répondre

0
Here is my splash activity xml 
This is an easy solution and places the text bellow the image. 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="fill_parent" 
android:background="@color/colorIcons" 
tools:context=".SplashActivity"> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_centerVertical="true" 
    android:gravity="center" 
    android:orientation="vertical"> 

    <ImageView 
     android:id="@+id/splashImage" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="30dp" 
     android:gravity="center_horizontal" 
     android:scaleType="fitCenter" 
     android:src="@mipmap/ic_launcher"> 
    </ImageView> 

    <TextView 
     android:id="@+id/splashText" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center_horizontal" 
     android:text="@string/app_name" 
     android:textColor="@color/colorPrimary_text" 
     android:textSize="36sp" /> 
</LinearLayout> 

+0

merci pour votre réponse, je n'avais pas réalisé que ce que j'essayais de faire était un "écran de chargement", cela vient après le "splash screen" dont je parle dans la question ci-dessus, qui ne peut être modifié, car il est un thème donné dans manifest.xml, et il se charge avant que l'application ne soit prête. Mais l '"écran de chargement" peut être personnalisé, car l'application est déjà capable d'afficher le contenu de l'activité. – Chipkat