发布网友 发布时间:2022-04-26 07:39
共1个回答
热心网友 时间:2023-10-08 22:46
你的报错类似于这么吗?
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity componentInfo{com.example.testtest/com.example.testtest.MainActivity}: java.lang.ClassCastException: android.widget.TextView cannot be cast to com.example.testtest.MarqueeText1
是这样的话,你可以把在activity_main.xml里面类似这样的部分
<TextView
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
改成这样
<com.example.testtest.MarqueeText1
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
就是把 TextView 改成 包名.MarqueeText1
如果不是这错误,最好把LogCat里面的错误信息贴出来看看追问