main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:text="@+id/customText"
android:id="@+id/customText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:textStyle="bold"
android:typeface="serif" />
</LinearLayout>
java文件:
setContentView(R.layout.main);
final Handler mHandler = new Handler();
final TextView tv = (TextView) findViewById(R.id.customText);
tv.setText("Playing...");
setContentView(tv);
当我运行它时,我收到一条强制关闭消息。
我是 android 开发的新手,非常感谢..:)
最佳答案
请移除setContentView(tv);下面 tv.setText("正在播放...");
关于Android:我在修改 main.xml 文件时收到强制关闭消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5455744/