2011-06-30 304 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章示例中獲得幫助。