我有一个 Android 应用程序,它需要一个按钮来打开一个新的 xml 页面。这就是现在的样子,有人可以添加必要的代码以在我单击按钮时打开 Page2Activity 吗?代码:
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Void onClick;View arg0; {
// TODO Auto-generated method stub
}
};
}
我使用这种方法解决了这个问题:http ://stackoverflow.com/questions/4094103/linking-xml-pages-with-layout ,但我也会尝试你的所有方法。