2011-06-30 203 views
1

我如何在按钮内嵌入布局布局。我的主要布局是线性布局,但我不知道如何编写主要activity.java类。任何人可以帮助我开始这就是我的main.java代码看起来像现在相对布局和线性布局

import android.app.Activity; 
import android.os.Bundle; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.content.Intent; 


public class Remote_DocActivity extends Activity implements OnClickListener {  
    /** Called when the activity is first created. */ 
    //private static final String TAG = "Remote_Doc"; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
     View Patient_Button = findViewById(R.id.patientButton); 
     Patient_Button.setOnClickListener(this); 
     View Doctor_Button = findViewById(R.id.doctorButton); 
     Doctor_Button.setOnClickListener(this); 
     View About_Option = findViewById(R.id.aboutButton); 
     About_Option.setOnClickListener(this); 
     View Exit_Option = findViewById(R.id.exit); 
     Exit_Option.setOnClickListener(this); 

    } 
    public void onClick(View v) { 
     switch (v.getId()) { 
     case R.id.aboutButton: 
      Intent i = new Intent(this, About.class); 
      startActivity(i); 
      break; 
     case R.id.exit: 
      finish(); 
      break; 
     } 
    } 

} 
+0

按钮内的标签布局?你想要的东西不清楚,也看看这可能是你想要的http://developer.android.com/resources/tutorials/views/hello-tabwidget.html – mkso

回答

1

你可以TabActivity类的帮助下创建的标签。您可以从android-wireless-application-development书籍的单元3第8章示例中获得帮助。