在按钮上显示文字单击
如何通过按下一个按钮
公共类数组{
static final int[] lvl1_plot1= {
R.string.plot1_1,
R.string.plot1_2,
R.string.plot1_3,
R.string.plot1_4,
};
public class calle1plot1扩展appcompatactivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.level1_plot1);
/**/
Array array = new Array();
/**/
final TextView textView1 = (TextView)findViewById(R.id.textView1);
final TextView textView2 = (TextView)findViewById(R.id.textView2);
final TextView textView3 = (TextView)findViewById(R.id.textView3);
final TextView textView4 = (TextView)findViewById(R.id.textView4);
final ImageView imageView = (ImageView) findViewById(R.id.img);
final Button skip = (Button) findViewById(R.id.skip);
final Button button_continue = (Button) findViewById(R.id.button_continue);
textView1.setText(array.lvl1_plot1[0]);
button_continue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
textView1.setText(array.lvl1_plot1[1]);
}
});
how to gradually display the text that is in the array by pressing one button
public class Array {
static final int[] lvl1_plot1= {
R.string.plot1_1,
R.string.plot1_2,
R.string.plot1_3,
R.string.plot1_4,
};
public class Level1plot1 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.level1_plot1);
/**/
Array array = new Array();
/**/
final TextView textView1 = (TextView)findViewById(R.id.textView1);
final TextView textView2 = (TextView)findViewById(R.id.textView2);
final TextView textView3 = (TextView)findViewById(R.id.textView3);
final TextView textView4 = (TextView)findViewById(R.id.textView4);
final ImageView imageView = (ImageView) findViewById(R.id.img);
final Button skip = (Button) findViewById(R.id.skip);
final Button button_continue = (Button) findViewById(R.id.button_continue);
textView1.setText(array.lvl1_plot1[0]);
button_continue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
textView1.setText(array.lvl1_plot1[1]);
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
textswitcher
遵循此链接中第一个答案的步骤:平滑的文本更改Android动画
Try to use a
TextSwitcher
Follow the steps from the first answer in this link: Smooth text change in android animation