java - 在启动画面 Android 上包含文本

标签 java android xml splash-screen

我正在使用这个网站上流行的方法来制作启动画面: Splash Screens the Right Way .

而且我想显示“正在加载”到不同语言的翻译文本。之前在评论区有人问过这个问题,作者回复了,但是我不知道怎么按他说的去做。这是他的回复:https://www.bignerdranch.com/blog/splash-screens-the-right-way/#comment-2633426495

如何在屏幕上绘制文本? (如果可能的话)或者正如它在那里所说的那样,如何将它“包含”在可绘制对象中?

另一种方法更可取吗?

最佳答案

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>

关于java - 在启动画面 Android 上包含文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44447512/

相关文章:

android - 关于下载.epub书后显示android网页

java - 对 (Button)findViewById 的错误感到困惑

python - 将 SOAP 信封添加到 ElementTree 生成的 XML

java - 哈希码使用未显示在代码中

java - Raspberry Pi、java、SPI 和触摸屏

java - Android 应用程序和 Java 服务器问题。连接被拒绝

Java SAX : how to use DefaultHandler in the main class

java - 将字符串数组转换为字节数组

java - xml 节点上的 getTextContent 返回空指针异常

android - Android上如何通过拖动查看大图?就像我们在 Google map 上所做的一样