一个activity(1)调用另外一个activity(2),2上面的控件没有显示??
我在1上面做了个按钮,调出2,2上面也有按钮等,2显示后,没有控件显示出来,请教各位是什么原因?本人刚开始学习,莫笑啊,呵呵

解决方案 »

  1.   

    把2的xml和activity代码贴下。。
      

  2.   


    package com.example.test2;import android.app.Activity;
    import android.os.Bundle;public class NewActivity extends Activity {
          protected void OnCreate(Bundle savedInstanceState)
          {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.new_activity);
           Bundle bundle = this.getIntent().getExtras();
           String name = bundle.getString("name");
           int age = bundle.getInt("age");
          }
    }
      

  3.   


    <AbsoluteLayout 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:orientation="vertical" >    <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#000000"
            android:text="@string/hello_world"
            tools:context=".NewActivity" />  </AbsoluteLayout>
      

  4.   

    AbsoluteLayout 时绝对布局,系统没提示你,你需要给控件设置layout_x,和layout_y吗?
      

  5.   

    搞定了,在java代码里面加入 @override,把OnCreate改成onCreate即可,大写变小写,坑爹的java,呵呵。
    public class NewActivity extends Activity {
           @override
          protected void onCreate(Bundle savedInstanceState)