gpt4 book ai didi

android - DisplayMessageActivity.java 上的 MyFirstApp android 教程错误

转载 作者:行者123 更新时间:2023-11-29 17:58:07 25 4
gpt4 key购买 nike

我一直在关注它,但我遇到了 3 个 TextView 错误教程:http://developer.android.com/training/basics/firstapp/starting-activity.html我收到 2 个错误,说 textView 无法解析,一个说 textView 无法解析为变量。帮助!

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the message from the intent
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);

// Create the text view
TextView textview = new TextView(this);
textView.setTextSize(40);
textView.setText(message);

// Set the text view as the activity layout
setContentView(textView);

setContentView(R.layout.activity_display_message);
// Show the Up button in the action bar.
setupActionBar();

`

最佳答案

您已将其声明为 textview(小写“v”)但引用它为 textView(大写“v”)。选择一个!

TextView textView = new TextView(this); // Change the "v" to uppercase
textView.setTextSize(40);
textView.setText(message);

关于android - DisplayMessageActivity.java 上的 MyFirstApp android 教程错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17795418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com