如何制作标签?

时间:2011-01-19 19:55:29

标签: android android-layout android-listview android-tabhost android-style-tabhost

新的android,我点击button1时有4个按钮,它会给出一个新的表单... box.java

import android.os.Bundle;
import android.content.Intent;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
public class Box extends CustomWindow {
@Override
    public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);


      Button b1 = (Button) findViewById(R.id.b1);
   b1.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
         Intent intent = new Intent();
         intent.setClass(Box.this, Group1.class);

         startActivity(intent);
      }
   });

   Button b2 = (Button) findViewById(R.id.b2);
   b2.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
         Intent intent = new Intent();
         intent.setClass(Box.this, Group2.class);

         startActivity(intent);
      }
   });

       Button b3 = (Button) findViewById(R.id.b3);
   b3.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
         Intent intent = new Intent();
         intent.setClass(Box.this, Group3.class);

         startActivity(intent);
      }
   });


   Button b4 = (Button) findViewById(R.id.b4);
   b4.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
         Intent intent = new Intent();
         intent.setClass(Box.this, Group4.class);

         startActivity(intent);
      }
   });

}
}

group1.java

import android.os.Bundle;
public class Group1 extends CustomWindow {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.group1);
}
}

问题:如何在group1上制作tabhost?

1 个答案:

答案 0 :(得分:0)

公共类group1扩展了tabactivity。 查看文档中的hello tablayout教程。