zoukankan      html  css  js  c++  java
  • android笔记01

    //获得控件
    factorOne=(EditText)findViewById(R.id. factorOne);
    //设置显示的string
    calculate.setText(R.string.calculate);
    //设置监听
    calculate.setOnClickListener(new CalculateListrner());
     
    监听类
            class CalculateListrner implements OnClickListener{
     
                   @Override
                   public void onClick(View v) {
                         String factorOneString= factorOne.getText().toString();
                         String factorTwoString= factorTwo.getText().toString();
                         
                         Intent intent= new Intent();
                         intent.putExtra( "one", factorOneString);
                         intent.putExtra( "two", factorTwoString);
                         intent.setClass(Activity03. this, ResultActivity.class);
                         
                         Activity03. this.startActivity(intent);
                  }
     
        }
    //添加菜单
            public boolean onCreatePanelMenu(int featureId, Menu menu) {
                   // TODO Auto-generated method stub
           menu.add(0, 1, 1, R.string. exit );
           menu.add(0, 2, 2, R.string. about);
                   return super .onCreatePanelMenu(featureId, menu);
           }
     
     
    //菜单项处理
            public boolean onOptionsItemSelected(MenuItem item) {
                   if(item.getItemId() == 1){
                         finish();
                  }
                   return super .onOptionsItemSelected(item);
           }
     
    注册activity
              <activity
                android:name=".ResultActivity"
                android:label="@string/result"
                >
           
            </activity>
     
    布局文件
    <?xml version= "1.0" encoding ="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation= "vertical"
        android:layout_width= "fill_parent"
        android:layout_height= "fill_parent"
        >
         <TextView
             android:id="@+id/result"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             />
    </LinearLayout>
  • 相关阅读:
    java 请求响应乱码
    基于eclipse的mybatis映射代码自动生成的插件http://blog.csdn.net/fu9958/article/details/7521681
    基于eclipse的mybatis映射代码自动生成的插件
    使用Mybatis Generator自动生成Mybatis相关代码
    MyBatis使用Generator自动生成代码
    selector是在文件夹drawable中进行定义的xml文件。
    新浪微博布局学习——妙用TabHost
    分布的拟合和检验
    python学习之--SyntaxError: Non-ASCII character 'xe5'
    两天学会DirectX 3D之入门
  • 原文地址:https://www.cnblogs.com/tiankonguse/p/2636712.html
Copyright © 2011-2022 走看看