Android 文本视图文本已更改但未显示
我有一个文本视图,当我使用Android 文本视图文本已更改但未显示,android,xml,textview,Android,Xml,Textview,我有一个文本视图,当我使用tv.setText(“hello”)更改文本时它更改了文本,因为我使用'Log.d(TAG,tv.getText());”进行检查但当我运行应用程序时,更改不会显示在视觉上。有什么问题吗 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getBundleData(); setContentView(R.layout.
tv.setText(“hello”)更改文本时代码>它更改了文本,因为我使用'Log.d(TAG,tv.getText());”进行检查代码>但当我运行应用程序时,更改不会显示在视觉上。有什么问题吗
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getBundleData();
setContentView(R.layout.activity_device_sensor_report);
context = this;
tempN = (TextView) findViewById(R.id.tv_temperature_num);
tempC = (TextView) findViewById(R.id.tv_temperature_cat);
humidityC = (TextView) findViewById(R.id.tv_humidity_cat);
tempN.setText("" + liveDataNum[0]);
humidityC.setText("" + liveDataCat[1]);
Log.d("TAG", ""+humidityC.getText());
drawGraph();
}
XML(相当复杂):
请张贴您的完整代码。我认为问题在于别的。您上面发布的代码是正确的。但是在那之后,实现了哪些代码?我认为代码会影响xml
TextView humidityC = (TextView) findViewById(R.id.tv_humidity_cat);
humidityC.setText("Humidity");
Log.d("TAG", ""+humidityC.getText());
请在您使用的地方共享代码,但当我运行应用程序时,更改不会显示在视觉上。请共享您的xml和代码。请检查文本的颜色代码,可能是它的白色,其中是tv.setText
?humidityC.setText(“+liveDataCat[1]);检查liveDataCat[1]包含什么?检查textcolor alsoHappy以帮助您@tirsrami如果出现任何其他问题将帮助您:):):)哈哈哈,但好的方面是它现在可以工作了。所以享受@tirsrami吧
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence$2) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
TextView humidityC = (TextView) findViewById(R.id.tv_humidity_cat);
humidityC.setText("Humidity");
Log.d("TAG", ""+humidityC.getText());