你指的导错是什么意思?
findViewById没错的。

解决方案 »

  1.   

    Button也是继承View的,都是正确的。SDK也是官网下载的。
      

  2.   


    你指的导错是什么意思?
    findViewById没错的。看看R文件 是不是你这个项目的 就是类最上面的import
      

  3.   


    如果是自己项目的R 那就 project-clean 选中自己项目 clean一下
      

  4.   

    把 R.layout.activity_main 贴出来看看
      

  5.   


    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/container"
        
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="me.softlmis.phone.MainActivity"
        tools:ignore="MergeRootFrame" />
      

  6.   


    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="me.softlmis.phone.MainActivity$PlaceholderFragment" >    <Button
            android:id="@+id/bt_Num"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="52dp"
            android:text="@string/dail" />
      

  7.   

    把android:id="@+id/bt_Num"中的bt_Num改成bt,然后保存一下。
    再将bt改回bt_Num,然后保存一下。
    应该就可以了
      

  8.   

    在建立工程的时候,默认有fragment_main和activity_main,前者作为后者的一部分加载进去的。但是我很奇怪,为什么前者没加上去。从而导致Button获取不到。而,如果直接把这些控件放到后者中,却可以找到。具体原因还不知道为什么这样。吐槽:总觉得吧,与Java相关的东西都不稳定,eclipse也是、android也是。不知道你们玩Java是怎么过来的,千锤百炼吗?
      

  9.   

    按钮命名出错了,只能是小写的字母,可以带下划线,我也遇到过这样的问题。你的button肯定没有生成相应的id。
      

  10.   

     setContentView(R.layout.activity_main);
     
            if (savedInstanceState == null) {
                getFragmentManager().beginTransaction()
                        .add(R.id.container, new PlaceholderFragment()).commit();
            }
    将以上代码改为
    setContentView(R.layout.fragment_main);
      

  11.   

    是不是你的R文件中没有这个id呀,
      

  12.   

    新版的玩不惯就去下个旧版的Eclipse吧
      

  13.   

    检查下import的时候R是不是对的
      

  14.   

    1、R 要指向自定义包里面的类,不能使用android系统的R
    2、如果view是定义在fragment里面,参照:http://blog.csdn.net/enson16855/article/details/27339947
      

  15.   


    应该就是main页面没有f页面的元素,所以才找不到。看了帖子,谢谢你了。