How to make a tab?
new in android, i have 4 button on clicking button1, it gives a new form... 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) {
开发者_Python百科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);
}
}
Problem: How to make tabhost on group1?
Public class group1 extends tabactivity. Check the hello tablayout tutorial in the documentation.
精彩评论