0

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?

4

1 回答 1

0

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

于 2011-01-19T20:10:29.310 回答