您的位置:首页 > 移动开发 > Android开发

widget.Button cannot be cast to android.widget.ListView

2015-04-14 20:42 399 查看
04-14 12:37:43.696: E/AndroidRuntime(1963): FATAL EXCEPTION: main

04-14 12:25:07.227: E/AndroidRuntime(1691): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android_robot_01_app/com.android_robot_01_app.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.ListView

04-14 12:37:43.696: E/AndroidRuntime(1963): java.lang.IllegalStateException: Could not find a method recordMessage(View) in the activity class com.android_robot_01_app.MainActivity for onClick handler on view class android.widget.Button with id 'id_chat_record'

04-14 12:37:43.696: E/AndroidRuntime(1963): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)

如上报了一堆错,其实就是布局问题,关键问题:android.widget.Button cannot be cast to android.widget.ListView

因为我也是初学,在一层一层的线性布局中,唯独没有给listview加入线性布局里,导致这个问题

如果谁有这种问题,查看一下,哪个控件没有加布局
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐