Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android极其简单的菜单问题_Android_User Interface - Fatal编程技术网

Android极其简单的菜单问题

Android极其简单的菜单问题,android,user-interface,Android,User Interface,我有一个关于Android菜单控制的非常简单的问题。我正在写一个程序,执行一些简单的数值计算并输出一个答案。我的问题是,当按下按钮时,如何使程序移到第二个屏幕,以及如何让用户移回原始屏幕。 这里有一个简单的例子 "Add Numbers" Input 1st # ____ Input 2nd # ____ (Add) 屏幕1 "Add Numbers" Input 1st # ____ Input 2nd # ____ (Add)

我有一个关于Android菜单控制的非常简单的问题。我正在写一个程序,执行一些简单的数值计算并输出一个答案。我的问题是,当按下按钮时,如何使程序移到第二个屏幕,以及如何让用户移回原始屏幕。 这里有一个简单的例子

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
屏幕1

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
屏幕2

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
The answer is "____"
用户输入两个整数。按add,然后程序移动到显示答案的第二个屏幕。如果用户需要,他们可以返回到第一个屏幕并重新开始

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 

我知道这已经被涵盖了,但有这么多的资源,我不知道该找什么。答案或资源链接将非常有用。谢谢大家!

我可以知道你使用的是哪种语言吗?
"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
我最近刚用C#做了。 我的流程是,当我启动一个程序时,它将自动强制进入第二个屏幕,并带有一些电源选项

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
但是如果你只是把程序移到不同的屏幕上,用C#就很容易了

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
因此,使用IDE中的intellisense,应该能够获得宽度、高度等。 我记不清了,但有些像src.width或src.bounds.width

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 

移动程序的最简单方法是将程序x轴移动到相应的屏幕。

我可以知道您使用的是哪种语言吗?
"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
我最近刚用C#做了。 我的流程是,当我启动一个程序时,它将自动强制进入第二个屏幕,并带有一些电源选项

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
但是如果你只是把程序移到不同的屏幕上,用C#就很容易了

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
因此,使用IDE中的intellisense,应该能够获得宽度、高度等。 我记不清了,但有些像src.width或src.bounds.width

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 

移动程序的最简单方法是将程序x轴移动到相应的屏幕。

看一下课程。它的工作原理类似于选项卡,但没有选项卡UI。您可以使用xml布局显示2个(或更多)屏幕,并()或()在屏幕之间切换。

查看该类。它的工作原理类似于选项卡,但没有选项卡UI。您可以使用xml布局显示2个(或更多)屏幕,并()或()在屏幕之间切换。

ViewFlipper将很好地工作。您也可以尝试“startActivityForResult”将答案传递到下一个屏幕。

ViewFlipper将很好地工作。您还可以尝试“startActivityForResult”将答案传递到下一个屏幕。

您可以使用以下屏幕布局输入数字。将文件命名为first.xml

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
单击侦听器代码

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
public void onClick(View v) {

                int n1 = Integer.parseInt(num1.getText().toString());
                int n2 = Integer.parseInt(num2.getText().toString());
                int result = n1 + n2;
                String res = Integer.toString(result);
                                Intent intent = new Intent(getApplicationContext(), Result.class);
                                intent.putExtra("result", result); //Passing the result to the second activity using intent
                startActivity(intent);
                }
在Result.java类中

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
public class Result extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result);
            Intent intent = getIntent();
                String result = intent.getStringExtra("result");
                TextView t1 = (TextView)findViewById(R.id.result);
                t1.setText(result);
    }
}

希望这有帮助。

您可以使用以下屏幕布局输入数字。将文件命名为first.xml

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
单击侦听器代码

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
public void onClick(View v) {

                int n1 = Integer.parseInt(num1.getText().toString());
                int n2 = Integer.parseInt(num2.getText().toString());
                int result = n1 + n2;
                String res = Integer.toString(result);
                                Intent intent = new Intent(getApplicationContext(), Result.class);
                                intent.putExtra("result", result); //Passing the result to the second activity using intent
                startActivity(intent);
                }
在Result.java类中

"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add) 
public class Result extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result);
            Intent intent = getIntent();
                String result = intent.getStringExtra("result");
                TextView t1 = (TextView)findViewById(R.id.result);
                t1.setText(result);
    }
}

希望这有帮助。

您使用的是什么平台、语言和技术?控制台输入/输出和C。Windows上的NET WPF?您使用的是什么平台、语言和技术?控制台输入/输出和C。Windows上的NET WPF?绝对是。你给了我一个直接的例子,正好说明我需要什么。这个起点对我帮助很大。非常感谢你!非常肯定。你给了我一个直接的例子,正好说明我需要什么。这个起点对我帮助很大。非常感谢你!非常感谢你的链接!我现在已经阅读了文档,我将重新阅读以获得全面的理解。非常感谢您提供的链接!我现在已经阅读了文档,我将重新阅读以获得全面的理解。
"Add Numbers"

Input 1st # ____       
Input 2nd # ____      
(Add)