在Android的动态更新的TextView [英] dynamically update TextView in Android

查看:147
本文介绍了在Android的动态更新的TextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很新的Andr​​oid开发。有人可以让我知道了相关的API动态更新的TextView (或整个屏幕)?

I am quite new to Android development. Can someone let me know the relevant APIs to dynamically update a TextView (or entire screen )?

例如:我有一个搜索应用程序,我需要显示的结果,因为他们发现,而不是等待所有结果,然后显示

For example: I have a search application and I need to show the results as they are found rather than waiting for all results and then show.

推荐答案

有几个步骤,你没有提到你知道多少对多少你不知道。

There are a few steps and you didn't mention how much you know versus how much you don't.

假设你的用户界面的初始结构定义在res /布局,它包括一个TextView的地方,在你的活动:

Assuming your UI initial structure is defined in the res/layout and it includes a TextView somewhere, in your activity:

public void updateTextView(String toThis) {

    TextView textView = (TextView) findViewById(R.id.textView);
    textView.setText(toThis);

    return;
}

这篇关于在Android的动态更新的TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆