Today mainly resolves the button's flashback problem and the settings of the answer page:
Layout Activity_result:
<?xml version= "1.0" encoding= "Utf-8"?>
<scrollview xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:background= "@mipmap/ff"
android:weightsum= "1" >
Xmlns:tools= "Http://schemas.android.com/tools"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:paddingbottom= "@dimen/activity_vertical_margin"
android:paddingleft= "@dimen/activity_horizontal_margin"
android:paddingright= "@dimen/activity_horizontal_margin"
android:paddingtop= "@dimen/activity_vertical_margin"
Tools:context= ". Resultactivity ">
<linearlayout
Android:layout_width= "Fill_parent"
android:layout_height= "202DP"
android:orientation= "Vertical" >
<textview
Android:id= "@+id/texttitle"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_marginleft= "30DP"
Android:textsize= "22SP"
android:layout_margintop= "36DP"
Android:textcolor= "#ff5e00"
android:text= "Your answer to the right answer is judged"/>
<textview
Android:id= "@+id/textresult"
Android:layout_width= "Wrap_content"
android:layout_height= "Match_parent"
android:layout_marginleft= "35DP"
Android:textcolor= "#f9453e4e"
android:text= "TextView"/>
<textview
Android:id= "@+id/textview1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_marginleft= "40DP"
Android:textsize= "12pt"
Android:textcolor= "#ff3c00"
android:text= "TextView"/>
</LinearLayout>
</ScrollView>
(position problem or powerless ....) )
In addition to some menu keys, the upper right corner
Resultactivity.class
PackageCom.example.mmmjh.calculator;
Importandroid.support.v7.app.AppCompatActivity;
ImportAndroid.os.Bundle;
ImportAndroid.app.ActionBar;
Importandroid.app.Activity;
ImportAndroid.content.Intent;
ImportAndroid.view.Menu;
ImportAndroid.view.MenuItem;
ImportAndroid.widget.TextView;
ImportAndroid.widget.Toast;
Public classResultactivityextendsappcompatactivity {
@Override
protected voidOnCreate (Bundle savedinstancestate) {
Super. OnCreate (Savedinstancestate);
Setcontentview (r.layout.Activity_result);
TextView text= (TextView) Findviewbyid (r.id.Textresult);
TextView text2= (TextView) Findviewbyid (r.id.TextView1);
Intent inten=getintent ();
Bundle Bundle=inten.getextras ();
int[]SHU1 = Inten.getintarrayextra ("SHU1");//generated numbers
int[]SHU2 = Inten.getintarrayextra ("SHU2");//generated numbers
String []user = Inten.getstringarrayextra ("User");//The results of the calculation
String []show = Inten.getstringarrayextra ("Show");//The resulting formula
int[]result = Inten.getintarrayextra ("Result");The right result
String time=bundle.getstring ("Time");//Spents
intScore=0;
String select="";
String all=" ";
for(intI=0; i<shu1.length; i++)
{
select="";
String resultstring="";
Resultstring=integer.toString(Result[i]);
if(User[i].equals (resultstring))
{
score++;//number of correct answers
select+="??";
}
Else
select+="??";
all+=""+show[i]+user[i]+" "+result[i]+" "+select+"\ n";
Text.settext (All);
}
Text2.settext ("This time altogether"+shu1.length+"problem, answer right"+score+"Way!" "+time);
}
@Override
Public BooleanOncreateoptionsmenu (Menu menu) {
//inflate the menu; This adds items to the action bar if it is present.
Menu.add (Menu.NONE, Menu. First+2,2,"Back to Settings page"). SetIcon (Android. R.drawable.Ic_menu_edit);
Menu.add (Menu.NONE, Menu. First+3,6,"Help"). SetIcon (Android. R.drawable.Ic_menu_help);
Getmenuinflater (). Inflate (R.Menu.Main, menu);
return True;
}
@Override
Public BooleanOnoptionsitemselected (MenuItem Item) {
Switch(Item.getitemid ()) {
CaseMenu. First+2:
Intent Intent =NewIntent ();
Intent.setclass (resultactivity. This, Activity_calculators.class);//Jump
StartActivity (Intent);
Break;
CaseMenu. First+3:
Toast.Maketext( This,"Help menu is clicked", Toast.Length_long). Show ();
Break;
}
return False;
}
}
(the button's flash-back problem is still not able to solve!) )
Elementary school arithmetic mental arithmetic practice app---No.6