Java android studio一直在利用我所有的输出消息?
我对这个网站很陌生,所以这只是我在这里的第二个问题。 我试图在Android Studio上创建一个简单的测试,每个输出似乎都因为某种原因而被资本化了。请帮助我了解为什么以及如何解决此问题。 例如,我所有的输出都是这样的:“A+B”而不是“A+B”,因此它们在数学上是不正确的 问题库代码部分:Java android studio一直在利用我所有的输出消息?,java,android,Java,Android,我对这个网站很陌生,所以这只是我在这里的第二个问题。 我试图在Android Studio上创建一个简单的测试,每个输出似乎都因为某种原因而被资本化了。请帮助我了解为什么以及如何解决此问题。 例如,我所有的输出都是这样的:“A+B”而不是“A+B”,因此它们在数学上是不正确的 问题库代码部分: private String mQuestions[] = {"Prove the simplest form of the following equation:"+express
private String mQuestions[] =
{"Prove the simplest form of the following equation:"+expression+"(4n+1)(n+8)-"+expression+"n(4n+1)",
"A rectangle of sides a"+expressioncube+" and a"+expressionsquare+". Prove its perimeter algebraically",
"Which of the following represents two consecutive square numbers where n is a positive integer?",
"For the equation a"+expressionsquare+"=25. The only value that a can hold is 5" ,
"If my rectangle has a perimeter of 2a+2b , what is its area?"};
private String mChoices[][] = {
{"4n+1", "n+1","n+8"},
{answer2, answer3,answer4},
{answer5+"and "+expressionsquare+"+2", answer5+"and "+answer6 ,answer5+"and "+answer7},
{"True", "False","Unsure"},
{"a+b", "ab","2(a+b)"}};
private String mCorrectAnswers[] = {"4n+1", answer3 , answer5+"and "+answer7, "False", "ab"};
public String getQuestion (int a){
String question = mQuestions[a];
return question;
}
public String getChoice1 (int a){
String choice0 = mChoices[a][0];
return choice0;
}
public String getChoice2 (int a){
String choice1 = mChoices[a][1];
return choice1;
}
public String getChoice3 (int a){
String choice2 = mChoices[a][1];
return choice2;
}
public String getCorrectAnswers (int a){
String answer = mCorrectAnswers[a];
return answer;
}
对不起,如果这不是网站上使用的结构,我仍在学习如何提出问题
主要活动的代码部分:
mScoreView=(TextView)findViewById(R.id.score);
mQuestionView=(TextView)findViewById(R.id.question);
mButtonChoice1=(Button)findViewById(R.id.choice1);
mButtonChoice2=(Button)findViewById(R.id.choice2);
mButtonChoice3=(Button)findViewById(R.id.choice3);
updateQuestion();
//start the button listener button1
mButtonChoice1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view){
if(mButtonChoice1.getText()==mAnswer){
mScore=mScore+1;
updateScore(mScore);
updateQuestion();
Toast.makeText(Algebraiexpressions.this, "Well Done", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(Algebraiexpressions.this, "Next Time", Toast.LENGTH_SHORT).show();
updateQuestion();
}
}
});
找到的解决方案:
1) 在代码中添加button.setTransformationMethod(null);
其中button是按钮的名称
2) android:textAllCaps=“false”在按钮的xml文件中,您正在设置按钮上的文本。android中
按钮的默认样式是将按钮的文本大写
您可以在按钮的默认样式(而不是按钮xml)上使用属性android:textAllCaps=“false”
来删除它。检查是否使用了textAllCaps
。这是唯一的数组,请提供查看(显示类)代码。您是否在按钮上设置了这些文本?按钮具有将传递的文本大写的样式。您在哪里设置这些文本??在文本视图上
或在按钮上
它们是在按钮上设置的