admin 管理员组文章数量: 887030
2023年12月18日发(作者:flex运行教程)
import
import
import
kListener;Button;EditText;public class MainActivity extends Activity { EditText num,name,sex,birthday,department,mail,information; Button register,request; String String_num,String_name,String_sex,String_birthday,String_department,String_mail,String_information; @Override protected void onCreate(Bundle savedInstanceState) { te(savedInstanceState); setContentView(ty_main); num=(EditText) findViewById(_ET); name=(EditText) findViewById(_ET); sex=(EditText) findViewById(_EV); birthday=(EditText) findViewById(ay_EV); department=(EditText) findViewById(_EV); mail=(EditText) findViewById(_EV); information=(EditText) findViewById(ation_EV); register=(Button) findViewById(er_BT); request=(Button) findViewById(t_BT); lickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String_num=t().toString(); String_name=t().toString(); String_sex=t().toString(); String_birthday=t().toString(); String_department=t().toString(); String_mail=t().toString(); t(String_num+" "+String_name+" "+String_sex+" "+String_birthday+" "+String_department+" "+String_mail); } }); lickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub t(""); t(""); t(""); t(""); t(""); t(""); t(""); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(, menu); return true; }}
import
import
import
import
import
import
import
import
Bundle;Activity;Menu;View;kListener;Button;EditText;TextView;public class MainActivity extends Activity { TextView outcome; EditText num1,num2; Button add,sub,mul,div; double d1,d2; String num11,num22; @Override protected void onCreate(Bundle savedInstanceState) { te(savedInstanceState); setContentView(ty_main); num1=(EditText) findViewById(1_ET); num2=(EditText) findViewById(2_ET); outcome=(TextView) findViewById(e_TV); add=(Button) findViewById(_BT); sub=(Button) findViewById(_BT); mul=(Button) findViewById(_BT); div=(Button) findViewById(_BT); lickListener(new OnListener()); lickListener(new OnListener()); lickListener(new OnListener()); lickListener(new OnListener()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(, menu); return true; } class OnListener implements OnClickListener{ @Override public void onClick(View v) { // TODO Auto-generated method stub num11=t().toString(); d1 = ouble(num11); num22=t().toString(); d2 = ouble(num22); if(()==_BT){ double all=d1+d2; t(all+""); }else if(()==_BT){ double all=d1-d2; t(all+""); }else if(()==_BT){ double all=d1*d2;
import
import
import
import
View;Button;EditText;Toast;public class MainActivity extends Activity { EditText A,B,C; Button reset,circumference,area; @Override protected void onCreate(Bundle savedInstanceState) { te(savedInstanceState); setContentView(ty_main); A=(EditText) findViewById(.A); B=(EditText) findViewById(.B); C=(EditText) findViewById(.C); reset=(Button) findViewById(); circumference=(Button) findViewById(ference); area=(Button) findViewById(); } public void resetClick(View view){ t(""); t(""); t(""); Toast toast = xt(,"已清空", _SHORT); (); } public void circumferenceClick(View view){ String sideA=t().toString(); String sideB=t().toString(); String sideC=t().toString(); double sA=ouble(sideA); double sB=ouble(sideB); double sC=ouble(sideC); Toast toast = xt(,sA+sB+sC+"", _SHORT); (); } public void areaClick(View view){ String sideA=t().toString(); String sideB=t().toString(); String sideC=t().toString(); double sA=ouble(sideA); double sB=ouble(sideB); double sC=ouble(sideC); double p=(sA+sB+sC)/2; double s=(p*(p-sA)*(p-sB)*(p-sC)); Toast toast = xt(,s+"", _SHORT); (); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(, menu); return true;
}}
版权声明:本文标题:移动开发技术(Android)——实验3Android常用基本控件(一) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1702914382h435790.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论