【发布时间】:2019-05-30 14:22:01
【问题描述】:
您好,我想在初始屏幕上的初始图像上添加文本。我在图像上添加了单个文本,但我想在每次应用打开时更改文本。如何做到这一点请告诉我。
我在它正在显示的 splash.xml 中添加了单个文本视图。但我想在每次应用打开时一个一个地显示 list.xml 中的所有项目。
<TextView
android:id="@+id/quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your limitation—it's only your imagination."
android:textColor="#ffffff"
android:textSize="36sp"
android:layout_centerInParent="true"/>
在 list.xml 中
<string-array name="quote_array">
<item>Your limitation—it's only your imagination.</item>
<item>Great things never come from comfort zones.</item>
<item>The harder you work for something, the greater you’ll feel when you achieve it.</item>
</string-array>
【问题讨论】:
-
只需在初始屏幕中获取数组列表,然后在设置文本(如 arraylist.get(random number))之后生成数组大小的随机数。
-
Quote.settext(arraylist.get(randomnumber));
标签: android android-layout splash-screen